Summary
Implement a native Agent Control Protocol (ACP) server mode in ZeroClaw to enable seamless integration with ACP-compatible clients, such as the Zed editor and other modern IDEs. This will allow ZeroClaw to act as a high-performance "coding agent" backend.
Problem statement
Currently, ZeroClaw primarily operates as a standalone CLI tool, a gateway for webhooks/websockets, or as an ACP client (via src/channels/acp.rs) to talk to other servers. However, it cannot yet act as an ACP server.
This is insufficient because:
- IDE Integration: Users want to use ZeroClaw directly within their code editors (like Zed) as a resident agent.
- Protocol Standardization: ACP is emerging as a standard for agent-client interaction (similar to LSP for languages or MCP for tools). Without server-side support, ZeroClaw remains isolated from this ecosystem.
- UX Parity: Other agent runtimes (like OpenClaw or Claude Code) support this mode, making ZeroClaw less accessible for developers who prefer IDE-integrated workflows.
Proposed solution
We propose adding a dedicated ACP server mode that communicates via JSON-RPC 2.0 over stdio (and optionally TCP/Unix sockets).
Interfaces & Commands
- New Command:
zeroclaw agent --acp or a dedicated zeroclaw acp subcommand.
- Transport: Default to
stdio for local IDE integration.
Core Protocol Implementation
initialize: Handle the handshake by reporting ZeroClaw's capabilities, version, and supported toolsets.
session/new: Create an isolated agent session with a specific working directory.
session/prompt: Bridge incoming prompts to the existing agent::process_message_with_session logic.
session/stop: Gracefully terminate active sessions.
Real-time Streaming
The server should stream progress back to the client using JSON-RPC notifications or partial results:
- Reasoning: Stream the agent's "thoughts" (hidden reasoning) as they are generated.
- Tool Execution: Notify the client when a tool is being called and when it completes.
- Content: Stream the final response incrementally.
Example Integration (Zed settings.json)
"coding_agents": {
"zeroclaw": {
"command": "zeroclaw",
"args": ["agent", "--acp"]
}
}
Non-goals / out of scope
- Implementation of a full MCP server (ZeroClaw should remain an MCP host that uses MCP tools).
- GUI components within ZeroClaw itself; the UI remains the responsibility of the ACP client (e.g., Zed).
- Complex multi-agent coordination within a single ACP session (initially).
Alternatives considered
- Gateway Bridge: Using the existing WebSocket gateway and a wrapper script to convert ACP-to-WS. Rejected: Adds unnecessary latency and complexity compared to a native
stdio server.
- LSP Extension: Implementing a Language Server Protocol (LSP) extension. Rejected: LSP is designed for static analysis and basic refactoring, whereas ACP is specifically designed for autonomous agent control and streaming.
Acceptance criteria
- Handshake Success: ZeroClaw responds correctly to
initialize and session/new.
- Agent Loop Execution: Prompts received via
session/prompt trigger the full agent loop, including tool discovery, memory recall, and execution.
- Streaming Verification: Clients receive real-time updates for both reasoning and tool calls.
- Security Compliance: Respects existing
autonomy_level and allowed_commands settings even when in ACP mode.
- Stability: The server handles process termination and session cleanup gracefully.
Architecture impact
src/channels/: A new acp_server.rs module will be needed (sharing some logic with the existing acp.rs client).
src/main.rs: Update command parsing to include the ACP mode.
src/agent/: Minor updates to ensure the agent loop can stream events to a provided callback/channel during ACP sessions.
src/gateway/: Potential refactoring of shared server utilities (JSON-RPC handling).
Risk and rollback
- Risk: Potential for resource exhaustion if too many sessions are opened.
- Mitigation: Implement session limits and timeouts.
- Rollback: The feature is additive and can be disabled by not using the
--acp flag. It does not affect existing CLI or Gateway modes.
Breaking change?
No
Data hygiene checks
Summary
Implement a native Agent Control Protocol (ACP) server mode in ZeroClaw to enable seamless integration with ACP-compatible clients, such as the Zed editor and other modern IDEs. This will allow ZeroClaw to act as a high-performance "coding agent" backend.
Problem statement
Currently, ZeroClaw primarily operates as a standalone CLI tool, a gateway for webhooks/websockets, or as an ACP client (via
src/channels/acp.rs) to talk to other servers. However, it cannot yet act as an ACP server.This is insufficient because:
Proposed solution
We propose adding a dedicated ACP server mode that communicates via JSON-RPC 2.0 over
stdio(and optionally TCP/Unix sockets).Interfaces & Commands
zeroclaw agent --acpor a dedicatedzeroclaw acpsubcommand.stdiofor local IDE integration.Core Protocol Implementation
initialize: Handle the handshake by reporting ZeroClaw's capabilities, version, and supported toolsets.session/new: Create an isolated agent session with a specific working directory.session/prompt: Bridge incoming prompts to the existingagent::process_message_with_sessionlogic.session/stop: Gracefully terminate active sessions.Real-time Streaming
The server should stream progress back to the client using JSON-RPC notifications or partial results:
Example Integration (Zed
settings.json)Non-goals / out of scope
Alternatives considered
stdioserver.Acceptance criteria
initializeandsession/new.session/prompttrigger the full agent loop, including tool discovery, memory recall, and execution.autonomy_levelandallowed_commandssettings even when in ACP mode.Architecture impact
src/channels/: A newacp_server.rsmodule will be needed (sharing some logic with the existingacp.rsclient).src/main.rs: Update command parsing to include the ACP mode.src/agent/: Minor updates to ensure the agent loop can stream events to a provided callback/channel during ACP sessions.src/gateway/: Potential refactoring of shared server utilities (JSON-RPC handling).Risk and rollback
--acpflag. It does not affect existing CLI or Gateway modes.Breaking change?
No
Data hygiene checks