An experimental ACP (Agent Client Protocol) adapter for Qodo Command, allowing it to work with Zed editor and other ACP-compatible clients.
This is a proof-of-concept implementation showing how to create an ACP adapter for a CLI tool that wasn't designed for programmatic interaction. While functional, it has significant limitations due to the mismatch between Qodo Command's terminal-based design and ACP's programmatic requirements.
This adapter implements the Agent Client Protocol to bridge between:
- ACP Clients (like Zed editor) that speak JSON-RPC over stdio
- Qodo Command CLI tool that expects terminal interaction
index.ts
- Entry point that sets up the server and handles process lifecycleacp-server.ts
- Implements the ACP protocol, handling JSON-RPC messagesqodo-bridge.ts
- Manages Qodo Command subprocess and translates between ACP and CLItypes.ts
- TypeScript type definitions for ACP protocol
- Initialization: When Zed starts the adapter, it sends an
initialize
request - Session Creation: Each conversation creates a new session via
session/new
- Message Handling: User messages are sent via
session/prompt
- Qodo Integration: The bridge runs
qodo --ci -y <prompt>
for each message in non-interactive mode - Progress Updates: Qodo's responses are streamed back as
session/update
notifications
The adapter handles the differences between Zed's ACP implementation and the standard protocol:
initialize
→ Standard initializationsession/new
→ Creates a new conversation session (returnssessionId
)session/prompt
→ Sends a message and waits for completion (returnsstopReason
)session/update
→ Progress notifications during message processing
# Clone this repository
git clone https://github.com/mshirlaw/qodo-acp-adapter.git
cd qodo-acp-adapter
# Install dependencies
npm install
# Build the TypeScript code
npm run build
Add to your Zed settings.json
:
{
"agent_servers": {
"Qodo Command": {
"command": "node",
"args": ["/full/path/to/qodo-acp-adapter/dist/index.js"],
"env": {
"ACP_DEBUG": "true", // Enable debug logging (optional)
"QODO_PATH": "/usr/local/bin/qodo" // Custom qodo path if needed (optional)
}
}
}
}
Note: Make sure to use the full absolute path to the adapter's dist/index.js
file.
Due to the fundamental mismatch between Qodo Command's terminal-based design and ACP's programmatic requirements:
-
No Conversation Context: Each message runs as an independent
qodo --ci
command, so there's no memory between messages. Qodo won't remember previous questions or answers within a session. -
Terminal UI Issues: Qodo Command uses Ink (React for terminals) which requires raw mode input. This doesn't work when running as a subprocess with piped stdio, forcing us to use CI mode which has limited functionality.
-
Limited Feature Set: Many Qodo features that require interactive mode (like the chat interface, real-time updates, and interactive prompts) don't work in CI mode.
-
No Session Persistence: While we track sessions in the adapter, Qodo itself doesn't maintain state between command invocations.
-
Authentication: Assumes Qodo is already authenticated via
qodo login
. The adapter cannot handle authentication flows.
-
Response Completion: The adapter waits for the process to exit to determine when Qodo has finished responding, which may not capture streaming responses properly.
-
Error Recovery: Basic error handling that may not gracefully recover from all failure scenarios.
-
Tool Integration: Doesn't handle Qodo's tool calls, MCP servers, or special slash commands.
-
Resource Handling: Cannot properly handle file references, images, or other resources that might be part of the conversation.
-
Performance: Each message spawns a new process, which has overhead and prevents efficient resource reuse.
# Run in development mode with hot reload
npm run dev
# Type checking
npm run typecheck
# Build for production
npm run build
Enable debug logging by setting the ACP_DEBUG
environment variable:
ACP_DEBUG=true node dist/index.js
Debug logs are written to stderr and include:
- Incoming ACP messages
- Qodo process management
- Message routing
- Response streaming
-
Context Injection: Prepend a summary of previous messages to each new prompt to simulate conversation memory:
const context = previousMessages.join('\n'); const fullPrompt = `Previous context:\n${context}\n\nCurrent question: ${message}`;
-
Response Caching: Store previous Q&A pairs and include relevant ones in new prompts to maintain some context.
-
Better Process Management: Implement a process pool to reuse Qodo processes where possible, reducing startup overhead.
-
Output Parsing: Parse Qodo's output to extract structured responses, code blocks, and tool calls.
-
Timeout Configuration: Make the response timeout configurable based on expected prompt complexity.
-
Native ACP Support in Qodo: The best solution would be for Qodo Command to implement ACP support directly, similar to how Gemini CLI did. This would involve:
- Adding an
--acp
flag to run in ACP server mode - Implementing proper session management
- Supporting streaming responses over JSON-RPC
- Handling tool calls and resources properly
- Adding an
-
Qodo API Mode: If Qodo provided a programmatic API or SDK (similar to Claude's SDK), the adapter could use that instead of the CLI:
import { QodoClient } from '@qodo/sdk'; const client = new QodoClient({ apiKey: process.env.QODO_API_KEY });
-
Alternative Protocol Support: Qodo could implement MCP (Model Context Protocol) server mode, which it already partially supports, making it easier to integrate with various clients.
-
Headless Mode: A headless mode for Qodo that doesn't require terminal UI but maintains session state would solve most current issues:
qodo --headless --session-id=xxx
If you're from the Qodo team or want to request these features:
- Issue to Open: "Add ACP (Agent Client Protocol) support for editor integration"
- Key Points to Mention:
- Growing adoption of ACP in editors (Zed, potentially VS Code)
- Need for programmatic access without terminal UI
- Session persistence across multiple prompts
- Streaming response support
- Reference Implementations:
- Agent Client Protocol Specification
- Claude Code ACP Adapter - Reference implementation
- Qodo Command Documentation
MIT - See LICENSE file for details
This is an experimental proof-of-concept. Feel free to fork and improve!