Go to file
Ben Brandt 81650db3d3 fix: keep Fast mode on when it is turned on after a model switch or mid-turn (#1637)
A user reported that turning Fast mode on "does nothing or keeps getting
reset". This fixes two causes, in both cores.

## Turning Fast mode back on did nothing

Claude Code acts on `applyFlagSettings({ fastMode: true })` only when
its flag does not already hold `true`, and ignores a repeat. Its flag
stays `true` when it stops serving Fast mode at a model switch: Fable
5.2 and Mythos 5.2 take only a Fast mode that was turned on while they
were selected.

So with Fast mode on under Opus:

1. The user switches to Fable 5.2. The toggle still shows on.
2. The next `system`/init reports `fast_mode_state: "off"` with no
reason, and the adapter turns the toggle off.
3. The user turns it on again. The adapter sends `fastMode: true`, which
Claude Code ignores.
4. The next prompt turns the toggle off again.

The adapter now sends `fastMode: false` before `fastMode: true`. This is
a workaround for that Claude Code behaviour (CLI 2.1.325), and
`applyFastModeFlag` in `session-fast-mode.ts` says so.

## A toggle changed during a turn flipped back when the turn ended

Claude Code reads the `fastMode` flag once when a turn starts and builds
that turn's init and its result from the one reading. The result
therefore reported the value from before the request, and the adapter
mirrored it until the next turn's init.

A result that repeats its turn's init is now ignored
(`fastModeResultIsNews`). A result that says more, such as an
`extra_usage_disabled` refusal, is mirrored as before, with its notice.

## Not changed

- Fast mode is still dropped at a switch to Fable 5.2, as in Claude
Code. The toggle shows on until the next prompt's init turns it off,
without a notice. It can now be turned on again.
- A request that Claude Code applies after it read the flag and before
it sent the init is not covered: that init reports the earlier value
too, and the next turn's init corrects the toggle.

## Verification

Drove the built adapter over ACP against Claude Code 2.1.325, with and
without the change. The org check was skipped
(`CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK=1`) and the prompts were
`/context` only, so this shows the toggle state and makes no model
request.

| step | `fast` on main | `fast` with this change |
| --- | --- | --- |
| turn Fast mode on (Opus 5.5), prompt | on | on |
| switch to Fable 5.2, prompt | off | off |
| turn Fast mode on, prompt | off | on |

The mid-turn case was not run against the real CLI, because it needs a
model turn. It is covered by the tests below.

## Tests

- v1 and v2: a client turns Fast mode on during a turn whose result
repeats the init, and the option stays on. On v1 the same flow with an
`extra_usage_disabled` result turns it off.
- v1 and v2: the requests sent for the toggle are `fastMode: false`,
then `fastMode: true`.
- Unit cases for `fastModeResultIsNews`.

The flow and request tests fail without the change.
2026-11-16 11:33:03 +00: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
  • 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
  • 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.

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.

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 83 MiB
Languages
TypeScript 99%
JavaScript 0.9%
Shell 0.1%