Skip to content

Finityno/claude-code-acp

 
 

Repository files navigation

ACP adapter for Claude Code

npm

Fork of @zed-industries/claude-code-acp

This fork adds support for subagent (Task tool) tracking and AskUserQuestion tool support.

Use Claude Code from ACP-compatible clients such as Zed!

Installation

npm i @finityno/claude-code-acp

Or install globally:

npm i -g @finityno/claude-code-acp

Features

This adapter implements an ACP agent using the official Claude Agent SDK:

  • Context @-mentions
  • Images
  • Tool calls (with permission requests)
  • Following
  • Edit review
  • TODO lists
  • Interactive (and background) terminals
  • Custom Slash commands
  • Client MCP servers
  • Subagent tracking (Task tool lifecycle events)
  • AskUserQuestion (Claude can ask clarifying questions)

Subagent Tracking

Track Task tool (subagent) lifecycle events:

import { ClaudeAcpAgent } from "@finityno/claude-code-acp";

const agent = new ClaudeAcpAgent(client);
const tracker = agent.subagentTracker;

// Listen for subagent events
tracker.addEventListener("subagent_started", (subagent) => {
  console.log(`Started: ${subagent.description} (${subagent.subagentType})`);
});

tracker.addEventListener("subagent_completed", (subagent) => {
  console.log(`Completed: ${subagent.id}`);
});

tracker.addEventListener("subagent_failed", (subagent) => {
  console.error(`Failed: ${subagent.error}`);
});

// Query subagents
tracker.getRunningSubagents();          // Currently active
tracker.getSessionSubagents(sessionId); // By session
tracker.getStats();                     // Counts & avg duration

See docs/subagent-tracking.md for full API documentation.

AskUserQuestion

Claude can ask clarifying questions during execution. Questions are presented via the ACP permission request system:

// Claude sends a question like:
{
  "question": "Which testing framework should we use?",
  "header": "Testing",
  "options": [
    { "label": "Jest", "description": "Popular JavaScript testing framework" },
    { "label": "Vitest", "description": "Vite-native, fast testing framework" }
  ],
  "multiSelect": false
}

// User selects an option, Claude receives:
{
  "answers": {
    "Which testing framework should we use?": "Vitest"
  }
}

Features:

  • Multiple questions per request (1-4)
  • 2-4 options per question with labels and descriptions
  • MultiSelect support for non-mutually-exclusive choices
  • "Other" option for free-text input

See docs/ask-user-question.md for ACP client integration details.

Usage

With Zed

The latest version of Zed can use this adapter out of the box. Open the Agent Panel and click "New Claude Code Thread" from the + button menu.

Read the docs on External Agent support.

Other Clients

Use with any ACP compatible client:

ANTHROPIC_API_KEY=sk-... claude-code-acp

License

Apache-2.0

About

Use Claude Code from any ACP client such as Zed!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.4%
  • JavaScript 0.6%