返回 CodeWhale
ACP.md
根目录 / docs / ACP.md
1 # Use Codewhale from your editor
2
3 `codewhale serve --acp` runs Codewhale as an agent for editors that speak the
4 [Agent Client Protocol](https://agentclientprotocol.com) (ACP), such as Zed.
5 The editor starts the command and talks to it over standard input and output;
6 no network port is opened. Conversations you start in the editor are ordinary
7 Codewhale conversations: they are saved in the same store and you can resume
8 them from the terminal.
9
10 For VS Code, use the [Codewhale extension](../extensions/vscode/README.md)
11 instead. It connects to the local Runtime API over HTTP, not ACP.
12
13 ## Set up
14
15 1. Install Codewhale and connect a model in the terminal first
16 ([Install](INSTALL.md), [Providers](PROVIDERS.md)). The editor uses the
17 same configuration and credentials.
18 2. Add Codewhale as a custom agent in the editor. In Zed, in `settings.json`:
19
20 ```json
21 {
22 "agent_servers": {
23 "Codewhale": {
24 "type": "custom",
25 "command": "codewhale",
26 "args": ["serve", "--acp"]
27 }
28 }
29 }
30 ```
31
32 The exact shape of this entry belongs to the editor and can change between
33 editor versions; check its ACP documentation if the entry is rejected. What
34 Codewhale needs is the command `codewhale` with the arguments `serve --acp`.
35 3. Open the editor's agent panel and start a conversation with Codewhale.
36
37 If the editor cannot find `codewhale`, give the full path that
38 `command -v codewhale` prints.
39
40 ## What works
41
42 - Start a conversation, list saved conversations and load one. Loading replays
43 the saved user and agent text and each tool call with its final status.
44 - Send a prompt and cancel it.
45 - Choose the model from the models your configured provider offers.
46 - Switch between Work and Plan. Plan is read-only.
47 - Approve or deny a tool call when Codewhale asks.
48
49 The agent can read and search files, use Git, apply patches and, when the
50 editor provides a terminal and your configuration allows shell commands, run
51 foreground shell commands. It can also use reviewed plugin tools
52 and the MCP servers you configured in Codewhale.
53
54 ## Permissions
55
56 The permission setting comes from your Codewhale configuration and the launch
57 command. The editor can see it but cannot widen it.
58
59 | You want | Do this |
60 | --- | --- |
61 | Ask before changes (default) | Nothing. A configured Accept Edits setting is also served as Ask here. |
62 | Auto-Review | Set it in your Codewhale configuration; see [Auto-Review](AUTO_REVIEW.md). |
63 | Full Access | Start with `codewhale serve --acp --full-access`, or set `yolo = true` in config. |
64 | Read-only | Set `sandbox_mode = "read-only"`; only Plan is offered. |
65
66 Each approval is for that one call. The editor cannot grant a remembered
67 permission. Plan stays read-only even under Full Access. Your typed permission
68 rules, hooks and repository rules apply as they do in the terminal; see
69 [Modes and permissions](MODES.md) and
70 [Authorization order](AUTHORIZATION_ORDER.md).
71
72 At startup Codewhale writes one line to standard error naming the permission
73 and sandbox it will run with. Look for it in the editor's agent log when a
74 launch command does not behave as you expected.
75
76 `approval_policy = "never"` is not supported on this transport; the command
77 refuses to start with it.
78
79 ## Limits
80
81 - MCP servers supplied by the editor are refused. Configure MCP servers in
82 Codewhale ([MCP](MCP.md)) instead.
83 - There is no tool search on this transport, so every connected MCP tool is
84 sent with every request, and a server marked `lazy = true` never starts. A
85 large MCP set costs tokens on each turn and can exceed a provider's tool
86 limit.
87 - Background shell tasks, the interpreter and sub-agents are not available
88 from the editor.
89 - A prompt runs for at most 50 model steps, or fewer if you configured a lower
90 limit. A goal does not continue on its own after the prompt ends.
91 - Reasoning and images are not replayed when you load a saved conversation.
92 Text the editor shows may be shortened; the saved history is complete.
93
94 ## When Codewhale is already running
95
96 If the desktop app or `codewhale serve --http` already owns the conversation
97 store, `serve --acp` attaches to it and the editor works from the same store.
98 If that owner exits, the editor's Codewhale process ends with an error naming
99 the exit; start a new conversation after restarting it. A second
100 `codewhale serve --acp` on a store another ACP server already owns refuses to
101 start.
102
103 ## Reference
104
105 The wire behaviour (methods, frame limits, error codes, replay and
106 cancellation) is in
107 [Runtime API: ACP stdio adapter](RUNTIME_API.md#acp-stdio-adapter-codewhale-serve---acp).
108
108 lines MARKDOWN