What is ACP?
The Agent Client Protocol is an open standard for connecting AI coding agents to code editors. It enables:- Editor Integration - Use OpenCode directly within your favorite editor
- Unified Experience - Consistent AI assistance across different development environments
- Tool Interoperability - Switch between different agents and editors seamlessly
- Native UI - Agents appear as native features in your editor’s interface
Configuration
To use OpenCode via ACP, configure your editor to run theopencode acp command. The command starts OpenCode as an ACP-compatible subprocess that communicates with your editor over JSON-RPC via stdio.
Supported Editors
Zed
Add to your Zed settings (~/.config/zed/settings.json):
- Open the Command Palette (
Cmd+Shift+PorCtrl+Shift+P) - Search for “agent: new thread”
- Select the command to start a new OpenCode thread
Custom Keyboard Shortcut
Bind a keyboard shortcut by editing yourkeymap.json:
Cmd+Alt+O (macOS) or Ctrl+Alt+O (Linux/Windows) to start OpenCode.
JetBrains IDEs
Add to your JetBrains IDEacp.json according to the documentation:
JetBrains requires an absolute path to the OpenCode binary. Use
which opencode on Linux/macOS or where opencode on Windows to find the path.- Open the AI Chat panel
- Select “OpenCode” from the agent selector
- Start chatting with OpenCode directly in your IDE
Avante.nvim
Add to your Avante.nvim configuration:With Environment Variables
If you need to pass environment variables:CodeCompanion.nvim
To use OpenCode as an ACP agent in CodeCompanion.nvim:For environment variables like
OPENCODE_API_KEY, refer to Configuring Adapters: Environment Variables in the CodeCompanion.nvim documentation.Features and Capabilities
OpenCode via ACP provides comprehensive feature support:Core Features
- Full Tool Access - All built-in OpenCode tools (file operations, bash commands, etc.)
- Custom Tools - Custom tools and slash commands from your configuration
- MCP Servers - Model Context Protocol servers configured in your OpenCode config
- Project Rules - Project-specific instructions from
AGENTS.mdfiles - Formatters and Linters - Custom code formatters and linters
- Agents - Multiple agent modes with different capabilities
- Permissions - Fine-grained permission system for tool execution
Session Management
- Create Sessions - Start new coding sessions
- Resume Sessions - Continue previous conversations
- Fork Sessions - Branch off from existing sessions to explore alternatives
- List Sessions - View and switch between all your sessions
Model Selection
- Multiple Models - Access all models from your configured providers
- Model Switching - Change models mid-session
- Model Variants - Use extended thinking and other model variants
Context and Tools
- File Context - Add files and code to the conversation
- Image Support - Send images for vision model analysis
- Resource Links - Reference external resources and documentation
- Command Execution - Run shell commands and see output
Real-time Updates
- Streaming Responses - See AI responses as they’re generated
- Tool Progress - Watch tool execution in real-time
- Permission Requests - Approve or deny tool usage interactively
- Thinking Display - View extended reasoning for supported models
Collaboration
- Session Sharing - Share sessions with team members
- Export - Export conversations to Markdown
- Comments - Add inline comments to code sections
Authentication
When using OpenCode via ACP, authentication is handled through the terminal:Permissions
OpenCode’s permission system works seamlessly through ACP. When OpenCode needs to execute a tool, your editor will display a permission dialog with options:- Allow Once - Execute this tool call only
- Always Allow - Execute this tool and automatically approve future calls
- Reject - Deny execution
Advanced Configuration
Custom Working Directory
OpenCode respects the working directory set by your editor. ACP automatically provides the correctcwd for each session.
MCP Server Configuration
MCP servers configured in youropencode.json are automatically available when using ACP:
Custom Commands
Slash commands defined in your configuration work through ACP:/build in your editor’s OpenCode interface to execute the command.
Limitations
Some built-in slash commands like
/undo and /redo are currently unsupported via ACP. These commands rely on Git operations that are better handled through your editor’s native version control.Editor-Specific Limitations
Different editors may have varying levels of ACP support:- Some editors may not display reasoning/thinking blocks
- Permission UI may vary between editors
- File diff presentation depends on editor capabilities
Troubleshooting
OpenCode Command Not Found
If your editor can’t find theopencode command:
- Ensure OpenCode is installed and in your PATH
- Use the absolute path in the configuration:
- Restart your editor after installation
Authentication Errors
If you see authentication errors:- Run
opencode auth loginin your terminal - Verify your credentials are valid
- Check that API keys are properly configured
- Restart your editor after authentication
Connection Issues
If the ACP connection fails:- Check that OpenCode is properly installed
- Run
opencode acpmanually to verify it works - Check editor logs for error messages
- Ensure no firewall or security software is blocking the process
Performance Issues
If responses are slow:- Use
/compactto reduce session context - Start fresh sessions for new tasks
- Check your network connection if using remote models
- Monitor token usage and context limits
Comparison with TUI and Web
| Feature | ACP | TUI | Web |
|---|---|---|---|
| File editing | Via editor | Terminal | Built-in editor |
| Diff viewing | Editor’s diff viewer | Terminal output | Visual diff panel |
| Session management | Yes | Yes | Yes |
| Keyboard shortcuts | Editor-dependent | Full support | Full support |
| Multi-window | Editor-dependent | Single terminal | Multiple windows |
| Mobile support | No | Terminal apps | Yes |
| File tree | Editor’s file tree | No | Built-in tree |
| Terminal | Editor’s terminal | Native | Integrated panel |
- ACP - For integrated editor experience
- TUI - For keyboard-driven terminal workflows
- Web - For visual file browsing and collaboration
Best Practices
Session Organization
Keep sessions focused on specific tasks:- Create separate sessions for different features
- Use descriptive session names (via
/renameif supported) - Fork sessions when exploring alternatives
Context Management
Manage conversation context effectively:- Add only relevant files to context
- Use
/compactto summarize long conversations - Start fresh sessions for unrelated work
Permission Strategy
Develop a permission strategy that balances safety and convenience:- Review tool calls before approving “Always Allow”
- Use “Allow Once” for sensitive operations
- Configure auto-approve for safe, repetitive tools
Model Selection
Choose models appropriate for the task:- Use extended thinking models for complex problems
- Switch to faster models for simple tasks
- Monitor costs with expensive models
Future Development
The ACP protocol is actively evolving. Future improvements may include:- Enhanced editor integration capabilities
- Additional tool execution modes
- Improved real-time collaboration features
- Extended permission granularity