Back to the catalog

agent-calling

Gemini cli agent 增强组件,通过路径劫持和上下文注入在 Gemini CLI 中调用 其他模型。

Open source Open in the app JSON README (API)

About

Gemini cli agent 增强组件,通过路径劫持和上下文注入在 Gemini CLI 中调用 其他模型。

Details

Kind
Plugins
Topic
AI, RAG & memory
Publisher
xuansheep
Origin
gemini
Category
ferramentas
Version
0.1.0
Last push
2026-03-10T07:13:48Z
Repository state
ativo
Language
JavaScript
Added
2026-08-30 14:13:39
Updated
2026-08-30 14:13:39
Origin id
xuansheep/agent-calling-beta

README

# 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](README.md) | [简体中文](README.zh-CN.md)

- [x] 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
```bash
gemini extension install https://github.com/xuansheep/agent-calling
cd ~/.gemini/extensions/agent-calling
npm install
npm run build
```

### 3. Method 2: Via npm
```bash
npm install -g agent-calling
```
add Gemini setting.json
```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:

```bash
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:

```bash
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.

More