npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ni2khanna/claude-agent-acp

v0.23.2

Published

An ACP-compatible coding agent powered by the Claude Agent SDK with invocation-specific Claude state

Downloads

399

Readme

ACP adapter for the Claude Agent SDK

npm

Use the Claude Agent SDK from ACP-compatible clients such as Zed, or embed the adapter in your own ACP host.

This package exposes Claude Code as an ACP agent and adds the adapter behavior ACP clients expect:

  • prompt queueing per session
  • ACP session config options for mode and model
  • permission mediation for Claude tools
  • invocation-specific Claude auth, memory, and settings directories
  • merged MCP server, hook, tool, and disallowed-tool configuration
  • prompt translation for text, resources, and images
  • tool-call notifications, including terminal metadata for Bash

Learn more about the Agent Client Protocol.

Install

npm install -g @ni2khanna/claude-agent-acp

Run it as a regular ACP agent:

ANTHROPIC_API_KEY=sk-... claude-agent-acp

Prebuilt single-file binaries are also available on the Releases page for Linux, macOS, and Windows.

Client usage

Zed

Recent versions of Zed can use this adapter directly from the Agent Panel. See Zed's External Agent documentation for setup details.

Other ACP clients

Any ACP client that supports external agents can launch claude-agent-acp as its agent command.

Library usage

If you want the same adapter behavior inside your own process, use the exported library entry points instead of shelling out to the CLI:

import { AgentSideConnection, ndJsonStream } from "@agentclientprotocol/sdk";
import { ClaudeAcpAgent, nodeToWebReadable, nodeToWebWritable } from "@ni2khanna/claude-agent-acp";

const stream = ndJsonStream(nodeToWebWritable(process.stdout), nodeToWebReadable(process.stdin));

new AgentSideConnection(
  (client) =>
    new ClaudeAcpAgent(client, {
      defaultTools: ["Bash", "Read", "Glob", "Grep", "WebSearch", "WebFetch"],
    }),
  stream,
);

If you just want the default stdin/stdout transport, call runAcp() instead.

Session metadata and settings

The adapter accepts a few ACP _meta extensions when a session is created:

  • _meta.systemPrompt: replaces or appends to the default claude_code system prompt
  • _meta.disableBuiltInTools: legacy shorthand for tools: []
  • _meta.claudeCode.configDir: stores Claude state in <configDir>/.claude and auth files in <configDir>
  • _meta.claudeCode.options: forwards Claude SDK options, with ACP-owned fields overridden

_meta.claudeCode.options is merged with adapter behavior:

  • hooks, mcpServers, and disallowedTools are merged
  • tools is passed through as-is and defaults to the claude_code preset
  • cwd, includePartialMessages, permissionMode, canUseTool, allowDangerouslySkipPermissions, and the Claude executable path stay under ACP control

Settings are resolved with this precedence:

  1. user settings
  2. project settings
  3. local project settings
  4. enterprise managed settings

With a custom configDir, the adapter uses <configDir>/.claude/settings.json as the user layer, <configDir>/.claude/settings.local.json as the local layer, and skips the project layer under <cwd>/.claude.

Session lifecycle

The adapter keeps a small in-memory state machine per ACP session and uses prompt replay to hand off queued prompts:

stateDiagram-v2
    [*] --> Creating
    Creating --> Ready: new/load/resume/fork initialized
    Creating --> AuthRequired: backup auth exists but live auth is missing
    Creating --> NotFound: resume target missing
    Ready --> PromptRunning: prompt()
    PromptRunning --> Queued: prompt() while another prompt is active
    Queued --> PromptRunning: replayed queued user message hands off stream
    PromptRunning --> Ready: end_turn / max_tokens / max_turn_requests
    PromptRunning --> Cancelled: cancel()
    Cancelled --> Ready: prompt returns cancelled
    PromptRunning --> Removed: Claude process exits unexpectedly
    Removed --> [*]

More detail, including queue-handoff and terminal notification diagrams, lives in docs/ARCHITECTURE.md.

Documentation

License

Apache-2.0