Skip to content
Esc
↑↓navigate↵open⌘Jpreview
Start
On this page

Zed Editor Integration

Use Autohand Code CLI as an agent in the Zed editor. The CLI has a built-in Agent Client Protocol (ACP) mode, so Zed launches autohand --acp directly with no separate adapter.

Overview

Zed is an ACP client. When you add Autohand as an external agent, Zed starts autohand --acp as a child process and talks to it in JSON-RPC over stdin and stdout. The process stays running, so one Zed thread is one persistent Autohand session. See ACP Mode for the protocol details.

What you get:

  • Autohand threads in Zed’s Agent Panel, with streamed replies and tool activity
  • Permission requests shown in Zed, which you approve or reject there
  • Mode switching (Ask, Plan, YOLO, Auto) and model selection per session
  • Autohand slash commands, plus MCP servers that Zed passes to the session

Prerequisites

  • Autohand Code CLI installed: see CLI Overview. The install script needs no Node.js; the npm package needs Node.js 22 or newer.
  • Autohand Code CLI signed in or configured: ACP mode cannot show login screens, so finish setup in a terminal first.
  • Zed editor: Download Zed
# Check Autohand is installed
autohand --version

# Sign in, or run the setup wizard to choose a provider and model
autohand --login
autohand --setup

ACP mode reads credentials from the CLI config: an Autohand sign-in, or an API key for the active provider. It does not accept a token from Zed.

Installation

Step 1: Find the CLI path

Zed runs the command you give it. If Zed cannot find autohand on its PATH, use the full path:

which autohand

Step 2: Add Autohand to Zed’s settings

In Zed, open Agent Settings, go to External Agents, click Add Agent, then Add Custom Agent. Zed opens your settings.json with an agent_servers entry. Fill it in like this:

{
  "agent_servers": {
    "Autohand": {
      "type": "custom",
      "command": "autohand",
      "args": ["--acp"],
      "env": {}
    }
  }
}

--mode acp is the same as --acp. Replace autohand in command with the full path from Step 1 if needed.

Step 3: Start a thread

Open the Agent Panel and pick Autohand from the agent selector or the new-thread menu. You can also bind a key to agent: new external agent thread. Zed sends the project folder as the session’s working directory.

Configuration

ACP mode uses your normal Autohand configuration. Change it with autohand config set, /settings, or ~/.autohand/config.json, or pass CLI flags in args.

Flags that apply in ACP mode

Flag Effect
--config <path> Use a different config file
--profile <name> Layer profiles.<name> from the config onto the run without saving it
--set <key=value> Override one setting for the run (repeatable, never saved)
--allowed-tools, --disallowed-tools Limit which tools sessions can use
--worktree [name] Run each session in an isolated git worktree
--bare Skip hooks, LSP, plugin sync, auto-memory and AGENTS.md auto-discovery
--ephemeral Keep sessions out of session history
--search-engine <provider> Choose the web search provider

For example, to use a profile and keep sessions out of history:

"args": ["--acp", "--profile", "zed", "--ephemeral"]

ACP mode does not read --model. The starting model comes from the config (<provider>.model), and you can switch it per session from Zed’s model selector.

Permission modes

Each session has a mode you can change from Zed. The starting mode comes from permissions.mode in the config.

Mode Behavior Default when
Ask (default) Asks in Zed before actions that need approval Any other permissions.mode
Plan (plan) Inspects and plans without making changes permissions.mode is restricted
YOLO (yolo) Approves actions without asking permissions.mode is unrestricted
Auto (automode) Runs an autonomous workflow and approves actions Never the default

Using Autohand in Zed

Starting a session

Select Autohand in the Agent Panel and start typing. Text that starts with / runs an Autohand slash command.

You: Add error handling to the fetchUser function

Autohand: I'll read fetchUser and add error handling...
[Autohand reads the file, asks to edit it, runs tests]

Best practices

  • Be specific: Describe exactly what you want. Include file paths when relevant.
  • Use Plan mode for exploration: When browsing code or asking questions, Plan mode prevents changes.
  • Stay in Ask mode for edits you want to review: Zed shows each permission request before Autohand acts.
  • Use --worktree for larger changes: Changes land in a separate git worktree you can review and merge.

Example prompts

# Refactoring
"Refactor src/utils/api.ts to use async/await instead of promises"

# Bug fixing
"There's a null pointer error in handleSubmit - can you fix it?"

# Code generation
"Create a React hook for managing form state with validation"

# Code review
"Review the changes in my current git diff for potential issues"

# Documentation
"Add JSDoc comments to all exported functions in src/lib/"

Troubleshooting

Autohand does not start

Run dev: open acp logs from Zed’s Command Palette to see the messages between Zed and Autohand. Autohand writes its own log lines, prefixed [ACP], to stderr. Check that:

  • command points to the CLI (try the full path from which autohand).
  • args includes --acp.
  • The directory the process starts in is not /, a system directory, or your home directory itself. ACP mode checks its working directory (or --path) at startup and exits if it fails the safety check.

“Authentication required”

Cause: The CLI config has no Autohand sign-in and no API key for the active provider.

Solution: Run setup in a terminal, then start a new thread in Zed:

autohand --login
# or
autohand --setup

Test ACP mode outside Zed

Send an initialize request by hand. A JSON response on stdout means ACP mode works:

echo '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{}}}' | autohand --acp

Limitations

  • No interactive setup: ACP mode cannot show login or setup screens. Finish setup in a terminal first.
  • Workspace trust: ACP mode cannot answer a workspace trust prompt; the warning goes to stderr.
  • Display: How progress, tool calls and diffs look depends on Zed’s ACP support.

Next steps

Last updated on

Was this helpful?

Send Feedback

Help us improve this documentation page. Your feedback is valuable.

We'll only contact you if we need clarification