mcpField
G
gemini-use-claude-acp

gemini-use-claude-acp

github.com/genericserviceAgent workflows038 installsUpdated 23w ago
Repository

About gemini-use-claude-acp

gemini-use-claude-acp lets Gemini delegate a single prompt to a Claude Code ACP adapter and stream the response to stdout. It is for tasks needing Claude’s perspective or MCP-enabled coding assistance, with no persistent session.

Key features

  1. 01Starts a Claude Code ACP subprocess
  2. 02Sends a prompt and streams response
  3. 03Selects a model through CLAUDE_MODEL
  4. 04Passes a working directory through TARGET_CWD

Use cases

  1. 01Requesting Claude’s opinion on a problem
  2. 02Delegating a multi-step coding task
  3. 03Getting a second model’s perspective

MCP support

It connects to Claude Code through ACP; the resulting Claude session can use its MCP tools, including filesystem and shell.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/genericservice/claude-skills --skill gemini-use-claude-acp

After installing, type/gemini-use-claude-acpin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

scripts/
.gitignore
claude-delegate.mjs
package.json
pnpm-lock.yaml

Details

From the project README

Gemini → Claude via ACP

Spawn a Claude Code ACP adapter subprocess, send a prompt, stream the response to stdout, and terminate cleanly. No persistent session — one prompt, one response.

When to use

  • The task requires complex multi-step agentic coding with MCP tool access
  • You want Claude's reasoning on a specific problem
  • The user says "ask Claude", "use Claude for this", etc.
  • You want a second opinion from a different model

Setup (first use only)

cd ~/.gemini/skills/gemini-use-claude-acp/scripts
pnpm install

This installs @agentclientprotocol/sdk into the local node_modules/. Subsequent runs skip this step.

Usage

CLAUDE_MODEL=claude-sonnet-4-6 \
TARGET_CWD=/path/to/project \
node ~/.gemini/skills/gemini-use-claude-acp/scripts/claude-delegate.mjs \
  "Refactor the auth module to use JWT tokens. The code is in src/auth/."

The response streams to stdout as Claude generates it. Capture it:

response=$(node ~/.gemini/skills/gemini-use-claude-acp/scripts/claude-delegate.mjs "your prompt")

Environment variables

VariableDefaultDescription
CLAUDE_MODELclaude-sonnet-4-6Model to use (applied via ACP unstable_setSessionModel)
TARGET_CWDcurrent working dirWorking directory passed to the Claude session

How it works

  1. Spawns pnpm dlx @zed-industries/claude-code-acp with:
    • CLAUDE_CODE_SKIP_PERMISSIONS=1 — auto-approves all tool calls
    • TERM=dumb — prevents ANSI escape sequences in output
    • CLAUDECODE unset — prevents the adapter refusing to start inside another Claude session
    • ~/.local/bin prepended to PATH — ensures the claude binary is found
  2. Connects via @agentclientprotocol/sdk's ClientSideConnection + ndJsonStream
  3. Sends initialize → newSession → unstable_setSessionModel → prompt over ACP
  4. Streams agent_message_chunk deltas to stdout as they arrive
  5. Terminates the subprocess once the prompt response completes

Prompt construction tips

  • Include all relevant context in the prompt string — this is a fresh session with no prior history
  • Reference files by absolute path if you want Claude to read/edit them
  • Keep prompts focused: one clear task per invocation
  • Claude can use its MCP tools (filesystem, shell, etc.) during the session

Error handling

If the script exits non-zero, check stderr for:

  • pnpm dlx download failures (network, auth)
  • Claude auth errors — ensure claude CLI is authenticated
  • CLAUDECODE environment variable being set (indicates you're running inside Claude Code; the adapter refuses to nest)
  • ACP initialization failures

The script does not retry — surface the error to the user and suggest re-running after fixing the root cause.

Comments

Markdown supported