This extension is still under development; please use it at your discretion.
Calling other proxies and language models within the Gemini CLI.
- Claude code
- Codex
Agent Calling integrates Claude into the Gemini CLI ecosystem through three key mechanisms:
- Path Hijacking: Creates a temporary directory containing a proxy script named
claude(orclaude.cmd) and forces this directory to the front of the systemPATHenvironment variable. - Context Injection: The proxy script injects the current state of the Gemini CLI (such as workspace paths) as environment variables, allowing Claude to be aware of the Gemini context.
- Lifecycle Monitoring: The proxy script sends notifications before and after calling the actual Claude CLI, enabling the host (Gemini CLI) to synchronize UI states or execute subsequent logic.
- Official Claude CLI: Ensure that Anthropic's
claudecommand-line tool is installed and configured on your system. - Node.js Environment: Node.js 18+ is recommended.
gemini extension install https://github.com/xuansheep/agent-calling
cd ~/.gemini/extensions/agent-calling
npm install
npm run buildnpm install -g agent-callingadd Gemini setting.json
{
"mcpServers": {
"claude-mcp": {
"command": "agent-calling",
"args": []
}
}
}Once installed, Gemini CLI will expose a tool named claude. You can send instructions directly:
gemini claude "Analyze the architecture of src/index.ts and suggest refactorings"You can pass additional command-line options to the original Claude CLI via the args parameter:
gemini claude "Scan codebase" --args "--output-format json"To achieve automatic delegation of complex tasks, this project includes a GEMINI.md configuration file. When you perform the following operations in the Gemini CLI, the Agent will automatically invoke this extension based on the instruction set:
- System Architecture Analysis: e.g., "Analyze overall project architecture", "Identify dependencies between modules".
- Long-term Planning: e.g., "Generate a detailed implementation plan", "Create a refactoring roadmap".
- Deep Code Review: e.g., "Scan the codebase for potential security vulnerabilities".
- Complex Refactoring Suggestions: Involving decoupling logic or pattern refactoring.
- Context Injection: The Agent automatically injects the list of files currently being processed or related documents into the
prompt. - Structured Output: Claude is required to return results in JSON format by default (e.g., using
--output-format json) for subsequent automated processing.