You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/agent-client-protocol.md
+20-53Lines changed: 20 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,27 +2,28 @@
2
2
description: How CodeCompanion implements the Agent Client Protocol (ACP)
3
3
---
4
4
5
-
# ACP Protocol Reference
5
+
# Agent Client Protocol (ACP) Support
6
6
7
7
CodeCompanion implements the [Agent Client Protocol (ACP)](https://agentclientprotocol.com/) to enable you to work with coding agents from within Neovim. ACP is an open standard that enables structured interaction between clients (like CodeCompanion) and AI agents, providing capabilities such as session management, file system operations, tool execution, and permission handling.
8
8
9
9
This page provides a technical reference for what's supported in CodeCompanion and how it's been implemented.
10
10
11
-
## Protocol Support
11
+
## Implementation
12
12
13
13
CodeCompanion provides comprehensive support for the ACP specification:
-**Tool calls**: Full execution lifecycle with status tracking
67
-
-**Mode changes**: Automatic UI updates when modes switch
68
-
-**Available commands**: Dynamic command registration for completion
69
-
70
-
## Implementation Notes
71
-
72
-
### Message Buffering
73
-
74
-
JSON-RPC message boundaries don't always align with I/O boundaries. CodeCompanion buffers stdout from the agent process and extracts complete JSON-RPC messages line-by-line, ensuring robust parsing even with partial reads.
75
-
76
61
### State Management
77
62
78
63
Unlike HTTP adapters which are stateless (sending the full conversation history with each request), ACP adapters are stateful. The agent maintains the conversation context, so CodeCompanion only sends new messages with each prompt. Session IDs are tracked throughout the conversation lifecycle.
79
64
80
-
### Tool Call Caching
81
-
82
-
Tool call state is maintained in memory to support permission requests. When an agent requests permission for a tool call, the cached details enable features like the diff preview UI for file edits.
83
-
84
65
### File Context Handling
85
66
86
67
When sending files as embedded resources to agents, CodeCompanion re-reads the file content rather than using the chat buffer representation. This avoids HTTP-style `<attachment>` tags that are used for LLM adapters but don't make sense for ACP agents.
@@ -93,41 +74,27 @@ ACP agents can advertise their own slash commands dynamically. You can access th
93
74
94
75
CodeCompanion implements a `session/set_model` method that allows you to select a model for the current session. This feature is not part of the [official ACP specification](https://agentclientprotocol.com/protocol/draft/schema#session-set_model) and is subject to change in future versions.
95
76
96
-
### Graceful Degradation
97
-
98
-
CodeCompanion checks an agent's capabilities during initialization and gracefully falls back to supported content types. For example, if an agent doesn't support embedded context, files are sent as plain text instead.
99
-
100
77
### Cleanup and Lifecycle
101
78
102
79
CodeCompanion ensures clean disconnection from ACP agents by hooking into Neovim's `VimLeavePre` autocmd. This guarantees that agent processes are properly terminated even if Neovim exits unexpectedly.
103
80
104
-
## Key Features
105
-
106
-
-**Streaming**: Real-time response streaming with chunk-by-chunk rendering
107
-
-**Permission System**: Interactive approval for file operations with diff preview
108
-
-**Session Persistence**: Resume previous conversations across Neovim sessions
109
-
-**Mode Management**: Switch between agent modes (e.g. ask, architect, code)
110
-
-**MCP Servers**: Connect agents to external tools via the Model Context Protocol
111
-
-**Slash Command Completion**: Auto-complete agent-specific commands with `\command` syntax
112
-
-**Error Handling**: Comprehensive error messages and graceful degradation
113
-
114
81
## Protocol Version
115
82
116
83
CodeCompanion currently implements **ACP Protocol Version 1**.
117
84
118
85
The protocol version is negotiated during initialization. If an agent selects a different version, CodeCompanion will log a warning but continue to operate, following the agent's selected version.
119
86
120
-
## Known Limitations
87
+
## Current Limitations
121
88
122
89
-**Terminal Operations**: The `terminal/*` family of methods (`terminal/create`, `terminal/output`, `terminal/release`, etc.) are not implemented. CodeCompanion doesn't advertise terminal capabilities to agents.
123
90
124
91
-**Agent Plan Rendering**: [Plan](https://agentclientprotocol.com/protocol/agent-plan) updates from agents are received and logged, but they're not currently rendered in the chat buffer UI.
125
92
126
-
-**Audio Content**: Audio content blocks aren't sent in prompts, despite capability detection.
93
+
-**Audio Content**: Audio can't be sent or received
127
94
128
95
## See Also
129
96
97
+
-[Agent Client Protocol Specification](https://agentclientprotocol.com/) - Official ACP documentation
130
98
-[Configuring ACP Adapters](/configuration/adapters-acp) - Setup instructions for specific agents
131
99
-[Using Agents](/usage/chat-buffer/agents) - How to interact with agents in chat
132
-
-[Agent Client Protocol Specification](https://agentclientprotocol.com/) - Official ACP documentation
0 commit comments