Skip to content

feat: add claw-acp — ACP server bridge for IDE integration#2575

Open
joka-7 wants to merge 3 commits into
nanocoai:mainfrom
joka-7:feature/acp-agent-server-protocol
Open

feat: add claw-acp — ACP server bridge for IDE integration#2575
joka-7 wants to merge 3 commits into
nanocoai:mainfrom
joka-7:feature/acp-agent-server-protocol

Conversation

@joka-7
Copy link
Copy Markdown

@joka-7 joka-7 commented May 20, 2026

Demo

WebStorm AI Chat using NanoClaw as the agent backend via ACP — @file mention
attaches the file content, which is fetched from the IDE via fs/read_text_file
and forwarded to the NanoClaw agent in the prompt.

Screenshot from 2026-05-21 01-34-54

Summary

Adds claw-acp, a utility skill that makes NanoClaw available as an ACP server — so IDEs like WebStorm, Zed, and acpx can use NanoClaw as their AI backend via the Agent Client Protocol.


How it works

IDE (WebStorm / Zed / acpx)
  │  spawns claw-acp as a subprocess
  │  ACP JSON-RPC 2.0 over stdio
  ▼
claw-acp  (.claude/skills/add-acp-server/scripts/claw-acp.ts)
  │  JSON lines over Unix socket
  ▼
NanoClaw CLI channel  (data/cli.sock)
  │  routes to wired agent group
  ▼
Agent container → Claude → response
  │
  └──▶  back through CLI socket → claw-acp → IDE

No NanoClaw host changes. claw-acp is a pure bridge on top of the existing CLI channel — install the skill, add one config file to your IDE, done.


ACP server vs ACP client

NanoClaw already has an ACP client provider (feature/acp-agent-client-protocol) — where NanoClaw connects out to an external ACP agent and uses it as the container's AI backend.

This PR is the opposite direction: the IDE connects in to NanoClaw.

ACP client ACP server (this PR)
NanoClaw's role ACP client ACP server
Who initiates NanoClaw → external agent IDE → NanoClaw
What it changes Host + container provider code Standalone bridge script only
Skill type Feature skill Utility skill
Config agent_provider: "acp-client" on agent group ~/.jetbrains/acp.json or Zed settings

Both can run simultaneously — the IDE connects to NanoClaw via the server bridge, while NanoClaw's agent containers can still connect out to external ACP agents as their AI backend.


Supported ACP methods

Method Status Notes
initialize ✅ Full Returns promptCapabilities, serverInfo, authMethods
session/new ✅ Full Generates UUID session ID
session/prompt ✅ Full Non-streaming; full response in one session/update chunk
session/cancel ✅ Full Closes CLI socket
session/close ✅ Full Closes CLI socket
fs/read_text_file ✅ Full line/limit support; sandboxed to $HOME or NANOCLAW_FS_ROOT
fs/write_text_file ❌ Not supported

Install

/add-acp-server

Then add one config file to your IDE. See SKILL.md for JetBrains, Zed, and acpx config examples.


Files

File Purpose
.claude/skills/add-acp-server/SKILL.md Install steps + IDE config (JetBrains, Zed, acpx)
.claude/skills/add-acp-server/scripts/claw-acp.ts Bridge script (TypeScript/Bun, no build step)
.claude/skills/add-acp-server/scripts/claw-acp.test.ts Test suite (23 tests, bun:test)

Tests

23 tests, no live NanoClaw instance required. Mirrors the test structure of acp-client.test.ts using MockIO + MockCli helpers.

bun test ./.claude/skills/add-acp-server/scripts/claw-acp.test.ts

 23 pass
  0 fail
 44 expect() calls
Ran 23 tests across 1 file. [119.00ms]

Coverage:

Group Tests
LineReader feed/readLine, partial chunks, blank lines, end-of-stream, queued lines before null
handleInitialize correct protocol fields, id echoed
handleSessionNew valid UUID in result
handleSessionPrompt happy path, empty prompt, 50ms timeout, CLI socket closed mid-wait, multi-block concat
handleSessionCancel / handleSessionClose respond {}
handleFsReadTextFile reads file, line/limit, path outside root, missing path, file not found
run() dispatch unknown method → -32601, notification ignored, invalid JSON skipped

Known limitations

  • Single active session — CLI channel supports one client at a time; a second claw-acp process evicts the first
  • Non-streaming — full response delivered as one session/update chunk, not token-by-token
  • Read-only filesystemfs/read_text_file supported; fs/write_text_file not
  • Requires running NanoClawclaw-acp is a bridge, not a standalone AI server

joka-7 and others added 3 commits May 21, 2026 01:13
Adds `claw-acp`, a TypeScript/Bun script that exposes NanoClaw as an
ACP (Agent Client Protocol) server so IDEs like WebStorm, Zed, and acpx
can use NanoClaw as their AI backend via ACP JSON-RPC 2.0 over stdio.

The bridge forwards prompts to NanoClaw's existing CLI Unix socket and
returns responses through the ACP session — no host changes required.

Supported methods: initialize, session/new, session/prompt,
session/cancel, session/close, fs/read_text_file (with line/limit,
sandboxed to $HOME).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Exports LineReader, AcpBridge, and CliTransport. Adds injectable I/O
(input, output, connectCli, recvTimeoutMs, fsRoot) so tests run without
a live NanoClaw instance.

23 tests covering LineReader, all ACP methods, timeout, path sandboxing,
and error codes — mirrors the acp-client.test.ts pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When an IDE sends a resource_link block in session/prompt (e.g. a WebStorm
@file mention), the bridge now calls fs/read_text_file back on the IDE,
fetches the file content, and embeds it as text in the NanoClaw prompt.

Fixes the deadlock by firing session/prompt without blocking the run loop,
so incoming IDE responses can be processed while the prompt is in flight.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@joka-7 joka-7 changed the title Feature/acp agent server protocol feat: add claw-acp — ACP server bridge for IDE integration May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant