Skip to content

feat: Native ACP (Agent Client Protocol) provider for multi-agent orchestration #189

Description

@mrgoonie

Summary

Implement a native Go ACP client provider (ACPProvider) that enables GoClaw to orchestrate any ACP-compatible coding agent (Claude Code, Codex CLI, Gemini CLI, Cursor, Kiro, etc.) as a subprocess via JSON-RPC 2.0 over stdio.

Motivation

  • ClaudeCLIProvider exists but is Claude-specific — parsing stdout events from the claude binary
  • Agent Client Protocol (ACP) standardizes editor↔agent communication, supported by 14+ agents
  • One provider implementation covers all ACP agents through config-driven agent registry
  • Enables multi-agent orchestration: delegate coding subtasks to specialized agents

Proposed Architecture

GoClaw Agent Loop
  └─ ACPProvider (new)
       ├─ ProcessPool (sessionKey → subprocess)
       ├─ JSON-RPC 2.0 Conn (bidirectional over stdio)
       ├─ ACP Session lifecycle (initialize → session/new → session/prompt)
       └─ Tool Bridge (agent→client requests)
            fs/readTextFile  → GoClaw workspace (sandboxed)
            fs/writeTextFile → GoClaw workspace (sandboxed)
            terminal/create  → exec with deny patterns
            permission/req   → auto-approve (configurable)

Implementation Plan

6 phases, ~16h estimated:

Phase Description
1 ACP protocol types + JSON-RPC 2.0 transport (internal/providers/acp/)
2 Subprocess management + ACP session lifecycle (spawn, idle TTL, crash recovery)
3 ACPProvider implementing providers.Provider (Chat/ChatStream)
4 Tool bridge — handle agent fs/terminal/permission requests with security sandboxing
5 Config struct, DB provider type, gateway wiring (both config-based and DB-based)
6 Integration tests with mock ACP agent binary

Detailed plan: plans/260314-1239-acp-provider-integration/

Key Decisions

  • Direction: GoClaw as ACP Client (not server)
  • Transport: JSON-RPC 2.0 over stdio (agents as subprocesses)
  • Implementation: Native Go — no external dependencies, no ACPX/Node.js required
  • Scope: Generic — works with any ACP-compatible agent binary

New Files

internal/providers/acp/
├── types.go           # ACP protocol types
├── jsonrpc.go         # Bidirectional JSON-RPC 2.0
├── process.go         # Subprocess pool
├── session.go         # ACP session methods
├── tool_bridge.go     # Agent→client request handler
└── terminal.go        # Terminal registry

internal/providers/acp_provider.go   # Provider interface implementation
tests/integration/acp/               # Integration tests with mock agent

Security

  • Workspace sandboxing: path traversal prevention on fs requests
  • Shell deny patterns enforced on terminal/create
  • Env filtering: strip GoClaw secrets from subprocess environment
  • Permission model: configurable (approve-all / approve-reads / deny-all)

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions