Go to file
Jeremy Espinoza 893f7680c7 feat: start Remote Control with the session when Claude Code asks for it (#1523)
Closes #1396.

Terminal sessions connect to Remote Control on their own when
`remoteControlAtStartup` is on. Sessions started over ACP don't, so you
have to type `/remote-control` in each one.

Claude Code already reports this at startup: `initializationResult()`
includes `remote_control_auto_enable`. When it's true, the adapter now
turns Remote Control on right after the session is set up, with the same
`enableRemoteControl` call that `/remote-control` uses.

- It works for new, loaded, resumed and forked sessions, on ACP v1 and
v2. It runs once per query, so a session whose query restarts (after a
provider change or a sign-out, for example) connects again, since Remote
Control ended with the old query. A `/remote-control off` holds across
those restarts: the new query doesn't turn it back on. On v1, a plan
approved with a fresh context also restarts the query, but in the middle
of the turn, so it doesn't connect then.
- The result goes out as a notice instead of an agent message, since
nothing is mid-turn at that point. Clients without notice support get a
transcript line.
- A notice can't be withdrawn, so it says "Remote Control connected" (an
event) rather than "is active", which `/remote-control off` would make
untrue.
- Like `/remote-control`, it holds prompts back while it connects, and
it does nothing while Claude is already working. On v1, a
`/remote-control` sent while it connects is refused ("Try again in a
moment"), as during another `/remote-control`.
- `remote_control_auto_enable` isn't in the SDK's published types, so
it's typed locally like `enableRemoteControl`. A missing field means
off.
- Both cores share the startup steps through `RemoteControlAtStartup` in
`src/remote-control.ts`, beside the existing Remote Control helpers.
Each core holds prompts back and sends the notice its own way: v2 in
`src/v2/remote-control.ts`, v1 in the new `src/v1/remote-control.ts`,
which `/remote-control` now uses too.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Andrey Bragin <andrey.bragin@jetbrains.com>
2026-11-25 16:08:07 +01:00
2025-09-02 19:06:32 -03:00
2026-03-26 12:19:06 +01:00

ACP adapter for the Claude Agent SDK

npm

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"). Where an organization's managed settings (disableSideloadFlags) keep them out, a session starts without them and says so in a notice
  • 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 xhigh effort)
  • /mcp in the chat: the MCP server status as a list. The adapter runs /mcp reconnect, /mcp enable, and /mcp disable through 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
  • Prompt suggestions: the prompt that Claude Code predicts the user sends next, as ACP's unstable prompt_suggestions_update, for a client that advertises session.promptSuggestions
  • 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 _meta keys: 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

ACP v2 (Preview)

The adapter also serves ACP v2, which is in Preview: a client that asks for protocol version 2 or later in initialize gets v2, and every other client gets v1. v2 is not frozen yet, 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.

On v2, the command of a stdio MCP server must be an absolute path, such as /usr/local/bin/npx. session/new, session/resume and session/fork fail with -32602 for a relative one, such as npx. A v1 client can still send one.

session/prompt takes an idempotencyKey: a prompt that a client sends again with the same key is inserted once, and the retry gets the first messageId. The key is known for as long as Claude Code stores the message, also after a restart. A prompt that Claude Code does not store, such as a local command, keeps its key until session/close or the end of the connection.

The adapter announces a session cursor (cursor_update) before each user message that follows another entry of the conversation, live and in a replay. session/fork with its cursorId copies the history before that message, and fails with -32602 for any other cursorId. A v1 client gets cursors only when it declares clientCapabilities.session.cursors. A v1 replay (session/load) anchors each cursor before its replayed user message. A live v1 prompt is not reported to the client that sent it, so its cursor is anchored after the last agent message, thought, tool call or compaction before it, with the same cursorId that a later replay issues. A session that was resumed without a replay has no such entity, so its live prompts get no cursor until it replays. When a v1 turn reports no entity (it was cancelled or failed before any output, or it was a slash command), the next prompt's cursor has the same after <entity> anchor as the previous prompt's cursor, with a different cursorId: the client uses the latest.

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).

Description
Pull mirror of agentclientprotocol/claude-agent-acp (Apache-2.0): the ACP bridge that lets Buzz drive Claude Code
Readme 113 MiB
Languages
TypeScript 99.1%
JavaScript 0.8%
Shell 0.1%