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.

1. Statement of the Problem

The task was to investigate and fix a suspected bug in a gemini-cli, Node.js CLI tool. The problem was two-fold:

  1. Live Model Switching Failure: When a user switched the AI model during an interactive session (e.g., via a /model claude-opus-4-0 command), the underlying logic did not seem to update correctly.
  2. Incorrect Provider Routing: There was a suspicion that when using models from one provider (e.g., Google's Gemini), the tool was incorrectly attempting to send API requests to another provider (e.g., Anthropic's Claude).

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.

2. The Files Involved: A Map of the Codebase

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.

3. Broad Comparison of the Three Approaches