This document outlines the requirements and implementation plan for migrating the auto-code platform's primary LLM provider from Anthropic's Claude to Google's Gemini, utilizing the gemini-cli framework. The goal is to decouple the system from the specific claude-agent-sdk and introduce a provider-agnostic architecture that treats Gemini as a first-class citizen, matching the existing ecosystem features (MCP support, efficient context management, and CLI-based tools).
The current auto-code backend is tightly coupled to the claude-agent-sdk, making it difficult to switch providers or leverage alternative LLMs like Gemini or Codex. client.py directly imports and instantiates ClaudeSDKClient, and the frontend settings are hardcoded for Claude models (Opus, Sonnet, Haiku). This vendor lock-in limits cost optimization, model choice, and platform flexibility.
- Complete Migration: Fully remove
claude-agent-sdkand all Claude-specific code. - Integrate Gemini CLI: Implement a robust adapter for
gemini-clicontent generation and chat. - Maintain Parity: Ensure critical features like MCP (Model Context Protocol) support remain functional with Gemini.
- Update UI: Reflect the new provider options in the frontend settings.
We will introduce a protocol AgentClient in apps/backend/core/clients/base.py that defines the contract for all AI agents.
class AgentClient(Protocol):
async def query(self, prompt: str) -> Any: ...
async def receive_response(self) -> AsyncGenerator[AgentMessage, None]: ...A new client implementation apps/backend/core/clients/gemini.py which will wrap gemini-cli subprocess calls if preferred for specific features.
- Key Dependencies:
gemini-cli(CLI) - Authentication:
OAuth(handled via login) - Context Window: Leverage Gemini 3.0 Pro preview and 3 flash preview's 1M context window for superior whole-project analysis.
Refactor apps/backend/core/client.py:
- New: Reads
settings.agentFramework(or similar config).- Returns
GeminiClient(default and only option).
- Returns
- Define Protocol: Create
core/clients/base.py. - Create Adapter: Implement
core/clients/gemini.pyusinggemini-cli. - Update Factory: Modify
create_clientincore/client.pyto support the change. - CLI Updates: Update
insights_runner.pyandsimple_client.pyto use the factory instead of direct imports.
- Update Constants: Modify
shared/constants/models.ts:- Add
gemini-3.0-pro,gemini-3.0-flashtoAVAILABLE_MODELS. - Add
GeminitoTHINKING_LEVELS(using Gemini's reasoning capabilities if available, or mapping "thinking" to "detailed prompting").
- Add
- Settings UI: Update
GeneralSettings.tsx:- Use "Gemini" as the Agent Framework dropdown.
- Add input field for
GOOGLE_API_KEY/ or performing login.
- Unit Tests: Verify
GeminiClientadheres to theAgentClientprotocol. - Integration Tests: Run the
insights_runner.pywith the--model gemini-3.0-proflag to verify chat works. - Documentation: specific instructions in
QUICK_START_GEMINI.md.
- System Prompt: support injecting
GEMINI.md(renamed toAGENT.mdor similar) content into Gemini's system instruction. - MCP Support: The Gemini adapter MUST support tool calling. We will translate internal MCP tool definitions into Gemini's
toolsschema (Function Declarations) or use the OOTB capabilities of Gemini.
- Users can switch to Gemini 3.0 Pro in settings.
- Insights Chat returns valid answers about the codebase using Gemini.
- Legacy Claude functionality is completely removed and replaced.