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!
npm i @finityno/claude-code-acpOr install globally:
npm i -g @finityno/claude-code-acpThis 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)
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 durationSee docs/subagent-tracking.md for full API documentation.
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.
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.
Use with any ACP compatible client:
ANTHROPIC_API_KEY=sk-... claude-code-acpApache-2.0