On v1, a client's request that names a subagent's child session now fails with `-32602` (Invalid params), as it already does on v2. ## Why The subagents RFD changed on 2026-11-17: an Agent SHOULD reject a client's request that is not permitted for a child session with `-32602`, in both protocol versions. `session/close` and `session/delete` are included, and do not report success for a child. A child that the Agent announced is not an unknown session. `session/cancel` is the one message that can name a child. The v1 core treated a child's id as an unknown session: | Request | Before | Now | | --- | --- | --- | | `session/prompt`, `session/load`, `session/resume`, `session/fork`, `session/set_mode`, `session/set_config_option` | `-32002` | `-32602` | | `session/close`, `session/delete` | success | `-32602` | | `session/set_title`, `session/status`, `session/options` | handled as a session without a transcript | `-32602` | `session/cancel` of a child still stops the child. ## How - `NativeSubagentRuntime.hasChild` tells whether a session id is a child that the runtime announced in the RFD form. `cancelChild` now uses the same lookup. AIR's earlier draft of the RFD keeps its own rules, so the check is false there. - `ClaudeAcpAgent.assertNoChildSession` asks the runtime of each session of the connection. - `v1AgentApp` wraps each request that names a session in `ofRootSession`, so all of them get the same check before their handler runs. The wrapper is not `async`. It returns the handler's promise as it is, so a setup response keeps its place before the timer of `afterSetupResponse`. - `restrictedChild`, the error that the v2 core already threw, moves from `src/v2/tasks.ts` to `src/acp-subagents.ts`, which both cores share. ## Not covered - A child that only a `session/load` replay announced, and whose agent did not run again on this connection, is still an unknown session (`-32002`). The check covers the children of a running session. The v2 core has the same limit. - The adapter's own extension requests (steer, async task stop, goal) are unchanged. ## Tests - `acp-agent.test.ts`: each of the eleven requests, sent through the protocol router with a child's id, fails with `-32602` and names the child in `data.sessionId`. - `native-subagents.test.ts`: `hasChild` is true for an announced child, and false for the root, for an unknown id and in AIR's draft. `npm run build`, `npm run check` and `npm run test:run` pass (4335 tests). This branch and #1655 merge without conflicts.
ACP adapter for the Claude Agent SDK
Use Claude Agent SDK from ACP-compatible clients!
This tool implements an ACP agent by using the official Claude Agent SDK, supporting:
- Context @-mentions
- Images
- Tool calls (with permission requests)
- Compact file changes through the negotiated AIR diff patch extension
- Following
- Edit review
- TODO lists
- Nested subagent transcripts
- Interactive (and background) terminals
- Custom Slash commands
- Client MCP servers, including the ones that the client serves over the ACP connection (MCP-over-ACP,
"type": "acp") - An Ultracode session config option, which turns on Claude Code's dynamic workflows for every task. It appears when dynamic workflows are enabled and the model supports ultracode (any model with
xhigheffort) /mcpin the chat: the MCP server status as a list. The adapter runs/mcp reconnect,/mcp enable, and/mcp disablethrough the SDK control API, because Claude Code refuses them in SDK mode. A reconnect of an ACP server that needs authentication starts MCP OAuth through URL elicitation- Session-scoped long-running goals for AIR through the goal extension under
_meta.jetbrains.air.goal - Structured errors, recovery, and warnings through the opt-in session failure extension
- Concrete model and effort defaults through the opt-in recommended config value extension
- Tool permission presentation, editable choices, and durable effects through the permission extension
- One fact per field in every tool call report, as the ACP tool call contract defines
- All AIR extensions, capabilities, and
_metakeys: AIR extensions
Learn more about the Agent Client Protocol.
To try changes that have landed on main but are not released yet, install from the
preview channel — every push to main publishes one. See
docs/RELEASES.md.
npm install @agentclientprotocol/claude-agent-acp@preview
Standalone executables
Each release attaches archives for Linux (glibc and musl), macOS and Windows, on
x64 and arm64, to its GitHub release.
They need no Node.js install. Each holds two files: claude-agent-acp, and the
Claude CLI (claude) it runs. Keep them in the same directory; a symlink to
claude-agent-acp elsewhere works. To use a Claude CLI you already have
instead, set CLAUDE_CODE_EXECUTABLE. On Alpine, install libgcc and
libstdc++ first.
A CLI named with CLAUDE_CODE_EXECUTABLE gets a session's MCP servers on its
command line, where other users of the machine can read their env and
headers. The CLI that comes with the adapter gets them over stdin.
To build one for your machine (needs Bun) and check it:
npm run build:binary
npm run smoke:binary # add `-- --full` to drive a real session; needs a Claude login
Experimental ACP v2
The adapter also serves the draft ACP v2:
a client that asks for protocol version 2 or later in initialize gets v2, and every other client
gets v1. The draft can still change, and this surface changes with it.
CLAUDE_AGENT_ACP_PROTOCOL limits the adapter to one version. With v1, a client that asks
for v2 is negotiated down to v1. With v2, the adapter rejects the initialize of a v1 client.
auto, the default, serves both.
On v2 the adapter serves the session baseline (session/new, session/list, session/resume
with replay, which replay_complete ends, session/close, session/prompt, session/cancel), session/delete,
session/fork, session/status, session/options (with initial configOptions on session/new,
session/resume and session/fork), session/set_title, additional directories, config options (the mode is one), plans, notices,
compaction, display terminals for commands, permission requests, elicitation, providers, auth, and
subagents. Steering is v1 only for now.
Two parts of the draft are not served yet. session/prompt takes an idempotencyKey and does not
use it, so a prompt that a client sends again with the same key is inserted again. The adapter
announces no session cursors, so session/fork with a cursorId fails with -32602.
v2 is served by the v2 agent in src/v2/, which runs straight on Claude
Code instead of translating to v1. A v2 client that declares JetBrains AIR
(_meta.jetbrains.air) also gets the AIR extensions that ACP v2 does not cover.
Contribution Policy
This project does not require a Contributor License Agreement (CLA). Instead, contributions are accepted under the following terms:
By contributing to this project, you agree that your contributions will be licensed under the Apache License, Version 2.0. You affirm that you have the legal right to submit your work, that you are not including code you do not have rights to, and that you understand contributions are made without requiring a Contributor License Agreement (CLA).