Skip to content

Repository files navigation

Agent Calling


This extension is still under development; please use it at your discretion.


Calling other proxies and language models within the Gemini CLI.

English | 简体中文

  • Claude code
  • Codex

Core Architecture

Agent Calling integrates Claude into the Gemini CLI ecosystem through three key mechanisms:

  1. Path Hijacking: Creates a temporary directory containing a proxy script named claude (or claude.cmd) and forces this directory to the front of the system PATH environment variable.
  2. 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.
  3. 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.

Installation

1. Prerequisites

  • Official Claude CLI: Ensure that Anthropic's claude command-line tool is installed and configured on your system.
  • Node.js Environment: Node.js 18+ is recommended.

2. Method 1: Gemini CLI Direct Installation

gemini extension install https://github.com/xuansheep/agent-calling
cd ~/.gemini/extensions/agent-calling
npm install
npm run build

3. Method 2: Via npm

npm install -g agent-calling

add Gemini setting.json

{
  "mcpServers": {
    "claude-mcp": {
      "command": "agent-calling",
      "args": []
    }
  }
}

Usage

1. Direct Command Invocation

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"

2. Advanced Parameter Passthrough

You can pass additional command-line options to the original Claude CLI via the args parameter:

gemini claude "Scan codebase" --args "--output-format json"

Automation (GEMINI.md)

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:

Delegation Criteria

  • 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.

Automated Execution Protocol

  1. Context Injection: The Agent automatically injects the list of files currently being processed or related documents into the prompt.
  2. Structured Output: Claude is required to return results in JSON format by default (e.g., using --output-format json) for subsequent automated processing.

About

Calling other proxies in the gemini CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages