ACP Mode
Agent Client Protocol (ACP) mode provides session-managed, bidirectional communication with Autohand Code CLI. Built for editor integrations and persistent agent connections.
What is the Autohand ACP Mode integration?
Autohand ACP Mode exposes a persistent Agent Client Protocol connection for editors and other clients. It manages sessions and bidirectional events so a host can drive an Autohand coding agent without parsing terminal output.
| Status | Available |
| Requires | An ACP-compatible client and an Autohand Code CLI that is signed in or configured with a model provider. |
| Configure with | Point the client at the absolute path of autohand with the --acp argument. Authentication comes from the CLI’s own configuration. |
| Best for | Editor integrations and clients that keep an agent session open. |
Overview
ACP mode implements the Agent Client Protocol using @agentclientprotocol/sdk. Compared with RPC mode, it adds persistent session management, per-session modes, and model switching in a protocol that editors already speak.
ACP vs RPC
| Feature | ACP Mode | RPC Mode |
|---|---|---|
| Protocol | Agent Client Protocol over newline-delimited JSON | Autohand autohand.* methods over JSON-RPC 2.0, newline-delimited |
| Session management | Built-in (create, resume, fork, list) | One active session per process; attach to saved sessions with autohand.session.attach |
| Authentication | Inherits from CLI config; authenticate checks it |
Inherits from CLI config |
| Model switching | Runtime switching supported | autohand.modelSet |
| Permission modes | Configurable per session | Per process, changeable with autohand.permissionModeSet |
| Hook notifications | Streamed as events | Streamed as autohand.hook.* notifications |
| Best for | Editor integrations, long-running agents | Scripts, CI/CD, simple automation |
Getting Started
Start ACP Mode
Launch Autohand in ACP mode:
# Start ACP server
autohand --acp
# The server listens on stdin/stdout using ndJSON
Connection Flow
A client initializes the connection, optionally checks authentication, creates a session, and then sends prompts:
Client Autohand
|--- initialize ------------------->|
|<-- agentInfo, capabilities -------|
|--- authenticate (optional) ------>|
|<-- {} or auth error --------------|
|--- session/new ------------------>|
|<-- sessionId, modes, options -----|
|--- session/prompt --------------->|
|<-- session/update (streamed) -----|
|<-- session/request_permission ----|
|--- permission outcome ----------->|
|<-- stopReason --------------------|
Set up an editor or ADE
Autohand Code CLI includes a native ACP agent server. Any editor, IDE, or agentic development environment (ADE) that can launch a local ACP process over stdio can use it directly, with no adapter or plugin. The launch contract is always the same:
command: /absolute/path/to/autohand
args: --acp
autohand --mode acp is equivalent to autohand --acp.
| Client | Native Autohand setup |
|---|---|
| Zed | Supported as a custom External Agent |
| JetBrains IDEs | Supported as a custom AI Assistant agent |
| JetBrains Air | Supported in preview builds that expose Add ACP Agent |
| GitHub Copilot app | No custom local ACP-agent launcher is currently documented |
| Other ADEs | Supported when the client can launch a local stdio ACP agent |
Install from the ACP Registry
Install Autohand Code from the ACP Registry in Zed or in JetBrains IDEs 2025.3.2 and later. In Zed, open zed: acp registry; in JetBrains AI Chat, select Install From ACP Registry.
The registry currently installs the separately versioned @autohandai/autohand-acp@0.2.1 adapter. This page documents the ACP server built into Autohand Code CLI; use the native setup instructions below for that server.
Prerequisites
Confirm the CLI runs
autohand --versionConfigure authentication and a model
ACP mode cannot open the interactive setup wizard, so configure Autohand in a normal terminal first:
autohand --setup
# Or sign in to an existing configuration
autohand --loginAutohand reads its user configuration from ~/.autohand/config.json, config.toml, config.yaml, or config.yml. Keep provider credentials there instead of copying secrets into an editor’s ACP configuration.
Find the absolute path to the executable
GUI applications often inherit a smaller PATH than your shell, so use the absolute path as command.
command -v autohand(Get-Command autohand).SourceIn ACP mode, stdout carries only protocol messages and diagnostics go to stderr. Launch the binary directly when possible. A shell wrapper must never print banners or other text to stdout.
Zed
Zed runs custom ACP processes as External Agents. Open Agent Settings, then External Agents, click Add Agent, choose Add Custom Agent, and add Autohand to agent_servers:
{
"agent_servers": {
"Autohand Code": {
"type": "custom",
"command": "/absolute/path/to/autohand",
"args": ["--acp"],
"env": {}
}
}
}
Save, open the Agent Panel, and start an Autohand Code thread. Run dev: open acp logs from the command palette to inspect the protocol log. For remote hosts, dev containers, or SSH projects, the executable must exist in that environment.
JetBrains IDEs
JetBrains IDEs with AI Assistant can add a custom ACP agent to AI Chat.
Open the agent configuration
Open the AI Chat tool window, open the menu in the upper-right corner, and choose Add Custom Agent. JetBrains creates and opens ~/.jetbrains/acp.json.
Add Autohand
{
"default_mcp_settings": {
"use_custom_mcp": false,
"use_idea_mcp": false
},
"agent_servers": {
"Autohand Code": {
"command": "/absolute/path/to/autohand",
"args": ["--acp"],
"env": {}
}
}
}Select the agent
Save the file and select Autohand Code in AI Chat.
JetBrains can pass its configured MCP servers or the built-in IntelliJ MCP server to ACP agents, and Autohand connects to MCP servers supplied by the client. Set use_custom_mcp or use_idea_mcp to true only when you want those tools exposed to Autohand.
Use Get ACP Logs from the AI Chat menu to diagnose startup or protocol errors. JetBrains documents custom ACP agents as unsupported inside WSL, so install and launch Autohand in a supported host environment instead.
JetBrains Air
JetBrains Air is in public preview. On builds that expose Add ACP Agent, open a project, choose that action from a new task, and add Autohand to the acp.json file Air opens:
{
"agent_servers": {
"Autohand Code": {
"type": "custom",
"command": "/absolute/path/to/autohand",
"args": ["--acp"],
"env": {}
}
}
}
Keep any other entries already in the file. Air’s labels and file location may change during the preview, but the Autohand launch contract stays the same. The executable runs on the machine that runs the task: for Docker, remote, or cloud execution, install Autohand in that environment and use the path visible there.
GitHub Copilot app
The GitHub Copilot desktop app does not currently document a way to launch arbitrary local ACP agent servers. Its customization options (custom agents, skills, plugins, and MCP servers) extend the Copilot runtime; they do not replace it with another ACP agent.
GitHub Copilot CLI’s copilot --acp option makes Copilot an ACP agent server, the same role as autohand --acp. It does not turn the Copilot app into an ACP client for Autohand.
Any ACP-compatible client
A custom or future client works with Autohand when it can:
- Launch a local executable as an ACP agent over stdin and stdout.
- Pass a project working directory when creating a session.
- Keep the process alive for the session and close stdin on shutdown.
- Leave stdout untouched and capture diagnostics from stderr.
- Render, or safely handle, ACP permission requests.
The ACP entry point uses local stdio only. A client that accepts only remote HTTP or WebSocket ACP agents cannot launch it directly; install Autohand on the remote side and spawn it there.
To use a configuration other than the default user file, add --config after --acp:
{
"agent_servers": {
"Autohand Code": {
"command": "/absolute/path/to/autohand",
"args": ["--acp", "--config", "/absolute/path/to/config.json"],
"env": {}
}
}
}
Prefer an absolute command path. Add a minimal PATH to env only if Autohand needs to launch other local tools the client cannot find, and never put provider keys in a shared project file.
Core Methods
ACP messages are JSON-RPC 2.0 objects, one per line. Autohand implements the agent side of the ACP schema through @agentclientprotocol/sdk. The examples below show the exact wire format; id values are chosen by the sender.
initialize
Start the connection and discover Autohand’s capabilities.
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"my-editor","version":"1.0.0"}}}
{
"jsonrpc": "2.0",
"id": 0,
"result": {
"protocolVersion": 1,
"agentCapabilities": {
"promptCapabilities": { "embeddedContext": true, "image": true },
"loadSession": true,
"mcpCapabilities": { "http": true, "sse": true },
"sessionCapabilities": { "list": {}, "resume": {}, "fork": {} }
},
"agentInfo": {
"name": "autohand-cli",
"title": "Autohand Code",
"version": "0.9.8"
},
"authMethods": [
{
"id": "autohand-setup",
"name": "Set up Autohand Code",
"description": "Configure authentication and a model in an interactive terminal.",
"type": "terminal",
"args": ["--setup"]
}
]
}
}
agentInfo.version is the installed CLI version.
authenticate
Autohand has no in-protocol login. It uses the credentials already saved by autohand --login or autohand --setup. The single advertised auth method, autohand-setup, is a terminal method: a client that supports terminal auth can run the Autohand executable with --setup so the user can sign in or configure a provider.
{"jsonrpc":"2.0","id":1,"method":"authenticate","params":{"methodId":"autohand-setup"}}
authenticate returns an empty result when the config holds an Autohand login token or an API key for the configured provider:
{"jsonrpc":"2.0","id":1,"result":{}}
Otherwise it returns the ACP authentication-required error:
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"Authentication required","data":{"message":"Please run `autohand --setup` or `autohand --login` in your terminal."}}}
session/new
Create a session for a working directory. mcpServers lists MCP servers the client wants Autohand to connect for this session (stdio, HTTP, or SSE).
{"jsonrpc":"2.0","id":2,"method":"session/new","params":{"cwd":"/path/to/project","mcpServers":[]}}
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"sessionId": "…",
"modes": {
"availableModes": [
{ "id": "default", "name": "Ask", "description": "Ask before actions that need approval" },
{ "id": "plan", "name": "Plan", "description": "Inspect and plan without making changes" },
{ "id": "yolo", "name": "YOLO", "description": "Auto-approve actions without interruption" },
{ "id": "automode", "name": "Auto", "description": "Run an interactive autonomous workflow" }
],
"currentModeId": "default"
},
"models": {
"availableModels": [{ "modelId": "…", "name": "…" }],
"currentModelId": "…"
},
"configOptions": [ … ],
"_meta": { "commands": [{ "name": "…", "description": "…" }] }
}
}
Autohand then sends an available_commands_update with the slash commands the session supports. When the CLI runs with --worktree, the session works in an isolated git worktree created from cwd.
session/prompt
Send a prompt as ACP content blocks. Autohand accepts text, image (image/png, image/jpeg, image/gif, or image/webp), resource, and resource_link blocks. Text starting with / runs a supported slash command.
{"jsonrpc":"2.0","id":3,"method":"session/prompt","params":{"sessionId":"…","prompt":[{"type":"text","text":"Add error handling to src/routes/api.ts"}]}}
While the turn runs, Autohand streams session/update notifications:
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"…","update":{"sessionUpdate":"agent_message_chunk","content":{"type":"text","text":"I'll add error handling"}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"…","update":{"sessionUpdate":"tool_call","toolCallId":"…","title":"Write","kind":"edit","status":"in_progress","locations":[{"path":"src/routes/api.ts"}],"rawInput":{"path":"src/routes/api.ts"}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"…","update":{"sessionUpdate":"tool_call_update","toolCallId":"…","status":"completed"}}}
The request resolves when the turn ends:
{"jsonrpc":"2.0","id":3,"result":{"stopReason":"end_turn"}}
sessionUpdate |
Sent when |
|---|---|
agent_message_chunk |
The agent streams response text, slash-command output, or an error message. |
agent_thought_chunk |
The model streams reasoning. |
tool_call |
A tool starts (status: "in_progress"), with kind, locations, and rawInput. |
tool_call_update |
A tool finishes (status: "completed" or "failed"), with rawOutput. |
plan |
A team’s task list changes. |
session_info_update |
A prompt arrives. The first prompt also sets the session title. |
current_mode_update |
The session mode changes. |
available_commands_update |
The session’s slash commands are published. |
user_message_chunk |
History is replayed by session/load. |
Autohand returns stopReason end_turn or cancelled. Provider and model failures during a turn do not produce a JSON-RPC error: Autohand streams an agent_message_chunk of the form Error (<code>): <message> and ends the turn with end_turn.
session/cancel
Cancel the running turn. This is a notification, so it has no id and no response. The pending session/prompt resolves with stopReason: "cancelled".
{"jsonrpc":"2.0","method":"session/cancel","params":{"sessionId":"…"}}
session/request_permission
In default (Ask) mode, Autohand asks the client before risky actions. This is a request from Autohand to the client:
{
"jsonrpc": "2.0",
"id": 7,
"method": "session/request_permission",
"params": {
"sessionId": "…",
"toolCall": {
"toolCallId": "perm_…",
"title": "…",
"kind": "execute",
"status": "pending",
"locations": [],
"rawInput": { "tool": "run_command", "description": "…", "command": "npm test" }
},
"options": [
{ "kind": "allow_once", "name": "Yes", "optionId": "allow_once" },
{ "kind": "reject_once", "name": "No", "optionId": "deny_once" },
{ "kind": "allow_once", "name": "Allow Once", "optionId": "allow_session" },
{ "kind": "reject_once", "name": "Deny Once", "optionId": "deny_session" },
{ "kind": "allow_always", "name": "Allow Always (Project)", "optionId": "allow_always_project" },
{ "kind": "allow_always", "name": "Allow Always (User)", "optionId": "allow_always_user" },
{ "kind": "reject_always", "name": "Deny Always (Project)", "optionId": "deny_always_project" },
{ "kind": "reject_always", "name": "Deny Always (User)", "optionId": "deny_always_user" },
{ "kind": "reject_once", "name": "Enter alternative...", "optionId": "alternative" }
]
}
}
Reply with the selected option:
{"jsonrpc":"2.0","id":7,"result":{"outcome":{"outcome":"selected","optionId":"allow_once"}}}
For alternative, put the replacement instruction in outcome._meta.alternative; an empty alternative is treated as a denial. A cancelled outcome, or a request the client cannot complete, denies the action.
Session Management
Sessions persist in Autohand’s session store, so they can be listed and reopened from later connections.
| Method | Params | Result |
|---|---|---|
session/list |
cwd (optional filter), cursor (optional) |
sessions (sessionId, cwd, title, updatedAt), nextCursor |
session/load |
sessionId, cwd, mcpServers |
modes, models, configOptions |
session/resume |
sessionId, cwd, mcpServers (optional) |
modes, models, configOptions |
session/fork |
sessionId, cwd, mcpServers (optional) |
sessionId of the new session |
session/list returns up to 50 sessions per page; pass nextCursor back as cursor to get the next page. session/load replays the saved conversation as session/update notifications (user_message_chunk, agent_thought_chunk, agent_message_chunk) before it responds, while session/resume restores the session without replaying it. session/fork branches a session that is open on the current connection into a new saved session.
{"jsonrpc":"2.0","id":4,"method":"session/list","params":{"cwd":"/path/to/project"}}
{"jsonrpc":"2.0","id":4,"result":{"sessions":[{"sessionId":"…","cwd":"/path/to/project","title":"Add error handling to src/routes/api.ts","updatedAt":"2026-09-29T09:00:00.000Z"}]}}
A missing or unreadable session returns -32602 with a message such as Failed to load session: ….
Session Modes
Each session has a permission mode. Change it with session/set_mode:
{"jsonrpc":"2.0","id":5,"method":"session/set_mode","params":{"sessionId":"…","modeId":"plan"}}
The result is {}, and Autohand sends a current_mode_update session update with the new currentModeId.
| Mode ID | Name | Behavior |
|---|---|---|
default |
Ask | Asks the client for approval before actions that need it. |
plan |
Plan | Inspects and plans without making changes. |
yolo |
YOLO | Auto-approves actions without interruption. |
automode |
Auto | Runs an autonomous workflow and auto-approves actions. |
New sessions start from permissions.mode in the Autohand config: unrestricted maps to yolo, restricted maps to plan, and anything else starts in default. Any other mode ID is rejected with -32602.
Model Switching
Autohand exposes per-session settings as ACP config options and changes them with session/set_config_option. The model option switches the model without restarting.
{"jsonrpc":"2.0","id":6,"method":"session/set_config_option","params":{"sessionId":"…","configId":"model","value":"<model-id>"}}
The result contains the full, updated configOptions list.
configId |
Values | Default |
|---|---|---|
model |
Models available from the configured provider | The configured model |
thinking_level |
none, normal, extended |
normal |
auto_commit |
off, on |
off |
context_compact |
on, off |
on |
A value outside the option’s list returns -32602 (Invalid value "…" for config option "…"). Session responses also include a models object (availableModels, currentModelId) for clients that render a model picker from it.
Hook Notifications
Autohand mirrors its hook events to the client as ACP extension notifications. Every notification carries sessionId and timestamp. They are informational; clients that do not recognize them can ignore them.
{"jsonrpc":"2.0","method":"autohand.hook.preTool","params":{"sessionId":"…","toolId":"…","toolName":"run_command","args":{"command":"npm test"},"timestamp":"2026-09-29T09:00:00.000Z"}}
| Notification | Params besides sessionId and timestamp |
|---|---|
autohand.hook.sessionStart |
sessionType (startup or resume) |
autohand.hook.sessionEnd |
reason, duration |
autohand.hook.prePrompt |
instruction, mentionedFiles |
autohand.hook.preTool |
toolId, toolName, args |
autohand.hook.postTool |
toolId, toolName, success, duration, output |
autohand.hook.fileModified |
filePath, changeType (create, modify, or delete), toolId |
autohand.hook.postResponse |
tokensUsed, toolCallsCount, duration |
autohand.hook.stop |
tokensUsed, toolCallsCount, duration |
autohand.hook.sessionError |
error, code, context |
autohand.hook.permissionRequest |
tool, path, command, args |
autohand.hook.notification |
notificationType, message |
autohand.hook.subagentStop |
subagentId, subagentName, subagentType, success, duration, error |
autohand.hook.reviewStart, .reviewEnd, .reviewPaused, .reviewFailed, .reviewCompleted |
/review lifecycle details such as kind, status, target, duration, success, error |
To configure which hooks run, set them up in the Autohand hook configuration. The notifications only report what happened.
Integration example
Editors such as Zed, JetBrains IDEs, and JetBrains Air need only the configuration in Set up an editor or ADE. To build your own client, spawn autohand --acp and exchange JSON-RPC lines. Authentication comes from the user’s saved Autohand configuration, so the client passes no token.
import { spawn } from "node:child_process";
import { createInterface } from "node:readline";
const agent = spawn("/absolute/path/to/autohand", ["--acp"], {
stdio: ["pipe", "pipe", "inherit"], // stderr carries Autohand diagnostics
});
const lines = createInterface({ input: agent.stdout });
let nextId = 0;
const pending = new Map<number, (msg: any) => void>();
function send(msg: object) {
agent.stdin.write(JSON.stringify({ jsonrpc: "2.0", ...msg }) + "\n");
}
function request(method: string, params: object): Promise<any> {
const id = nextId++;
send({ id, method, params });
return new Promise((resolve, reject) =>
pending.set(id, (msg) => (msg.error ? reject(msg.error) : resolve(msg.result))),
);
}
lines.on("line", (line) => {
const msg = JSON.parse(line);
// Response to one of our requests
if (msg.id !== undefined && !msg.method) {
pending.get(msg.id)?.(msg);
pending.delete(msg.id);
return;
}
// Streaming updates
if (msg.method === "session/update") {
const update = msg.params.update;
if (update.sessionUpdate === "agent_message_chunk" && update.content.type === "text") {
process.stdout.write(update.content.text);
}
return;
}
// Permission request from Autohand: approve once
if (msg.method === "session/request_permission") {
send({ id: msg.id, result: { outcome: { outcome: "selected", optionId: "allow_once" } } });
}
});
const init = await request("initialize", {
protocolVersion: 1,
clientCapabilities: {},
clientInfo: { name: "my-client", version: "1.0.0" },
});
console.error(`Connected to ${init.agentInfo.title} ${init.agentInfo.version}`);
try {
await request("authenticate", { methodId: "autohand-setup" });
} catch {
console.error("Run `autohand --login` or `autohand --setup` in a terminal first.");
process.exit(1);
}
const { sessionId } = await request("session/new", { cwd: process.cwd(), mcpServers: [] });
const { stopReason } = await request("session/prompt", {
sessionId,
prompt: [{ type: "text", text: "List the files in this project" }],
});
console.error(`\nTurn ended: ${stopReason}`);
agent.stdin.end();
A VS Code extension can use the same pattern: spawn the process on activation, render session/update text in a webview or output channel, turn session/request_permission into a dialog, and end stdin on deactivation. TypeScript clients can also use @agentclientprotocol/sdk instead of handling JSON-RPC by hand.
Error Handling
Errors use standard JSON-RPC error objects. Autohand puts the detail in error.data.message:
{"jsonrpc":"2.0","id":3,"error":{"code":-32602,"message":"Invalid params","data":{"message":"Session not found"}}}
| Code | Message | Returned when |
|---|---|---|
-32000 |
Authentication required |
authenticate finds no Autohand login token or provider API key. |
-32602 |
Invalid params |
The session is unknown (Session not found), the mode or model is unsupported, a config value is invalid, an image type is unsupported, or a session cannot be loaded, resumed, or forked. |
-32601 |
"Method not found": <method> |
The client calls a method Autohand does not implement, such as session/close or session/delete. |
Failures inside a turn, such as provider or model errors, are reported as an agent_message_chunk and an autohand.hook.sessionError notification, not as a JSON-RPC error.
Troubleshooting
The client cannot find autohand
Use the absolute path returned by command -v autohand (macOS or Linux) or (Get-Command autohand).Source (Windows PowerShell). If the client runs the agent remotely or in a container, run the lookup there.
The agent starts but immediately asks for authentication
Run autohand --setup or autohand --login in a normal terminal, finish configuring a provider, and start a new session in the client. ACP mode does not open the setup wizard on its protocol stream.
Running autohand --acp appears to hang
This is expected when no client is connected. The process waits for protocol messages on stdin and does not show the terminal UI. Check autohand --version, then test ACP mode from the client.
The client reports malformed JSON or a handshake failure
Launch the Autohand executable directly and remove shell startup output or wrappers that print to stdout. Check the client’s ACP log and Autohand’s stderr output.
Tool calls are denied without a prompt
Confirm that the client implements ACP permission requests and that the session is in default (Ask) mode. A failed, cancelled, or unsupported permission request is denied.
The wrong project opens
Start the session from the intended project or worktree. Autohand uses the working directory the client supplies for each session, and applies its workspace safety check when ACP mode starts.
How do I configure the Autohand ACP Mode integration?
Configure your client to launch /absolute/path/to/autohand with the --acp argument. See Set up an editor or ADE for Zed, JetBrains IDEs, and JetBrains Air.
What does the Autohand ACP Mode integration require?
An ACP-compatible client that can launch a local stdio agent, and an Autohand Code CLI configured with autohand --setup or autohand --login.
What limitations should I know about?
ACP is session-oriented. Use RPC Mode when a simpler JSON stdin/stdout automation protocol is a better fit.