crocbot ACP Bridge
This document describes how the crocbot ACP (Agent Client Protocol) bridge works, how it maps ACP sessions to Gateway sessions, and how IDEs should invoke it.Overview
crocbot acp exposes an ACP agent over stdio and forwards prompts to a running
crocbot Gateway over WebSocket. It keeps ACP session ids mapped to Gateway
session keys so IDEs can reconnect to the same agent transcript or reset it on
request.
Key goals:
- Minimal ACP surface area (stdio, NDJSON).
- Stable session mapping across reconnects.
- Works with existing Gateway session store (list/resolve/reset).
- Safe defaults (isolated ACP session keys by default).
How can I use this
Use ACP when an IDE or tooling speaks Agent Client Protocol and you want it to drive a crocbot Gateway session. Quick steps:- Run a Gateway (local or remote).
- Configure the Gateway target (
gateway.remote.url+ auth) or pass flags. - Point the IDE to run
crocbot acpover stdio.
Selecting agents
ACP does not pick agents directly. It routes by the Gateway session key. Use agent-scoped session keys to target a specific agent:acp:<uuid> session unless you override
the key or label.
Zed editor setup
Add a custom ACP agent in~/.config/zed/settings.json:
Execution Model
- ACP client spawns
crocbot acpand speaks ACP messages over stdio. - The bridge connects to the Gateway using existing auth config (or CLI flags).
- ACP
prompttranslates to Gatewaychat.send. - Gateway streaming events are translated back into ACP streaming events.
- ACP
cancelmaps to Gatewaychat.abortfor the active run.
Session Mapping
By default each ACP session is mapped to a dedicated Gateway session key:acp:<uuid>unless overridden.
- CLI defaults
- ACP metadata per session
sessionKey: direct Gateway session key.sessionLabel: resolve an existing session by label.resetSession: mint a new transcript for the key before first use.requireExisting: fail if the key/label does not exist.
Session Listing
ACPlistSessions maps to Gateway sessions.list and returns a filtered
summary suitable for IDE session pickers. _meta.limit can cap the number of
sessions returned.
Prompt Translation
ACP prompt inputs are converted into a Gatewaychat.send:
textandresourceblocks become prompt text.resource_linkwith image mime types become attachments.- The working directory can be prefixed into the prompt (default on, can be
disabled with
--no-prefix-cwd).
message and tool_call
updates. Terminal Gateway states map to ACP done with stop reasons:
complete->stopaborted->cancelerror->error
Auth + Gateway Discovery
crocbot acp resolves the Gateway URL and auth from CLI flags or config:
--url/--token/--passwordtake precedence.- Otherwise use configured
gateway.remote.*settings.
Operational Notes
- ACP sessions are stored in memory for the bridge process lifetime.
- Gateway session state is persisted by the Gateway itself.
--verboselogs ACP/Gateway bridge events to stderr (never stdout).- ACP runs can be canceled and the active run id is tracked per session.
Compatibility
- ACP bridge uses
@agentclientprotocol/sdk(currently 0.13.x). - Works with ACP clients that implement
initialize,newSession,loadSession,prompt,cancel, andlistSessions.
Testing
- Unit:
src/acp/session.test.tscovers run id lifecycle. - Full gate:
pnpm lint && pnpm build && pnpm test && pnpm docs:build.
Related Docs
- CLI usage:
docs/cli/acp.md - Session model:
docs/concepts/session.md - Session management internals:
docs/reference/session-management-compaction.md
