Skip to content

Commit 5a96cee

Browse files
committed
fix: restore command-aware prompt execution
1 parent d1fd9be commit 5a96cee

9 files changed

Lines changed: 835 additions & 88 deletions

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ An [Agent Client Protocol (ACP)](https://github.com/agentclientprotocol/agent-cl
88

99
## About
1010

11-
This is an `ai-assisted` personal project aimed at bringing Cursor's agent into Zed. It acts as a **wrapper around native `agent acp`**, auto-approving tool calls when you opt in and preserving compatibility features that the current native ACP server does not expose yet.
11+
This is an `ai-assisted` personal project aimed at bringing Cursor's agent into Zed. It uses a hybrid approach: native `agent acp` where that helps ACP/session compatibility, and the legacy `agent --print --output-format stream-json` prompt path where that preserves richer tool-call details in clients.
1212

1313
**Based on [claude-code-acp](https://github.com/zed-industries/claude-code-acp)** by Zed Industries - the original ACP adapter for Claude Code that served as the architectural foundation for this project.
1414

1515
## Features
1616

17-
### Native-backed
17+
### Hybrid backend
1818

19-
- **Native ACP backend**: Uses `agent acp` instead of the older `agent --print --output-format stream-json` wrapper path
20-
- **Tool and message streaming**: Forwards native ACP `session/update` notifications to the client
19+
- **Command-preserving prompt execution**: Uses the legacy `agent --print --output-format stream-json` prompt path so shell tool calls keep the exact command text (`pwd`, `npm test`, etc.) in ACP clients
20+
- **Native ACP compatibility layer**: Keeps native `agent acp` for ACP/session compatibility work where the native backend is still useful
21+
- **Tool and message streaming**: Uses the stream-json mapper for prompt turns and still forwards native ACP `session/update` notifications where applicable
2122
- **Cursor extension RPCs**: Forwards native `cursor/*` extension methods and notifications (e.g. `cursor/ask_question`, `cursor/update_todos`) to the outer ACP client when supported
2223
- **Cursor commands and skills**: Relies on native ACP `available_commands_update` for Cursor/user commands and skills
2324
- **Native command precedence**: When Cursor advertises a slash command, the adapter forwards that command to native ACP instead of intercepting it locally
@@ -38,11 +39,12 @@ This is an `ai-assisted` personal project aimed at bringing Cursor's agent into
3839

3940
- Native Cursor ACP on the currently validated CLI does **not** expose `session/list`, `session/resume`, or `session/set_model`
4041
- Resuming after restarting `cursor-acp` uses native `session/load` when a stored `backendSessionId` is available; if that fails, the adapter starts a **new** native session and replays local JSONL so visible history is preserved
42+
- Prompt execution intentionally stays on the legacy stream-json runner because current native execute-tool updates do not include the original command string
4143
- `debug` mode is intentionally not exposed in this phase
4244

43-
## Breaking changes (native ACP & Yolo)
45+
## Breaking changes (hybrid backend & Yolo)
4446

45-
If you used an older `cursor-acp` that drove Cursor through the legacy **`agent --print --output-format stream-json`** path, upgrading changes behavior in ways that are easy to mistake for “bugs” unless you know what moved:
47+
Recent `cursor-acp` versions changed backend strategy more than once. The current release is hybrid: prompt execution uses the legacy **`agent --print --output-format stream-json`** path again so commands render correctly, while native `agent acp` is still used for compatibility/session features where it helps.
4648

4749
### Configuration env vars removed
4850

@@ -52,12 +54,13 @@ Earlier releases documented `CURSOR_ACP_DEFAULT_MODE` and `CURSOR_ACP_DEFAULT_MO
5254

5355
Older builds accepted `bypassPermissions` and `autoRunAllCommands` as synonyms for **`yolo`** in `default_mode` and in `/mode`. Those names are **no longer accepted**—use **`yolo`** (or pick **Yolo** in the client).
5456

55-
### Native `agent acp` backend
57+
### Hybrid backend
5658

57-
- **Execution model**: The adapter now spawns **native `agent acp`** and speaks ACP to Cursor’s server. Session traffic, slash-command routing, and tool permission flows follow **native ACP**, not the previous wrapper-only protocol.
59+
- **Execution model**: Prompt turns run through the legacy stream-json CLI path, while session compatibility features still use native `agent acp` where useful.
60+
- **Why this changed**: Current Cursor native ACP execute-tool updates collapse shell commands to a generic `Terminal` tool call with no original command string. The legacy stream-json path preserves `shellToolCall.args.command`, which lets ACP clients render the true command.
5861
- **Slash commands**: If Cursor advertises a command name that matches a built-in wrapper command (for example `/model`), the **native command wins** and is forwarded to the backend; the wrapper no longer always intercepts those names.
59-
- **Permissions**: Tool and action approval is mediated through **native `requestPermission`** notifications. The adapter translates them to the outer ACP client unless you opt into Yolo (below).
60-
- **Resume / listing**: Resume uses native **`session/load`** when a stored backend session id is available; native Cursor ACP still does not expose everything the outer protocol can represent (see **Known limitations**). Expect differences versus the old stream-json session lifecycle.
62+
- **Permissions**: Prompt-time tool visibility now comes from the stream-json path, while wrapper mode handling still controls retries and Yolo behavior.
63+
- **Resume / listing**: Resume still uses native **`session/load`** when a stored backend session id is available; native Cursor ACP still does not expose everything the outer protocol can represent (see **Known limitations**).
6164

6265
### Yolo mode (`yolo`)
6366

@@ -210,6 +213,8 @@ You can also bind a keyboard shortcut to quickly open a new Cursor thread by add
210213

211214
If something isn't working, open Zed's Command Palette and run `dev: open acp logs` to inspect the ACP messages being sent between Zed and cursor-acp.
212215

216+
Set `CURSOR_ACP_DEBUG_LOG=1` if you also want the adapter to write extra debug traces to `~/.cursor-acp/logs/debug.log`.
217+
213218
### Development
214219

215220
```bash

docs/breaking-changes.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Breaking changes
2+
3+
The up-to-date notice for upgrades involving the current **hybrid backend** and **Yolo** (`yolo`) mode lives in the main project README:
4+
5+
**[Breaking changes (hybrid backend & Yolo)](../README.md#breaking-changes-hybrid-backend--yolo)**
6+
7+
That section covers:
8+
9+
- the return to the legacy **`agent --print --output-format stream-json`** prompt path for accurate shell command display
10+
- continued use of native **`agent acp`** for session compatibility features
11+
- removal of `CURSOR_ACP_DEFAULT_MODE` / `CURSOR_ACP_DEFAULT_MODEL`
12+
- removal of legacy Yolo aliases like `bypassPermissions` / `autoRunAllCommands`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@raphael/cursor-acp",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "ACP adapter backed by Cursor Agent CLI",
55
"main": "dist/lib.js",
66
"types": "dist/lib.d.ts",

0 commit comments

Comments
 (0)