A Node.js wrapper script for integrating the Cursor AI development agent with OpenClaw's ACP (Agent Control Protocol) runner (acpx).
The wrapper intercepts the standard input/output streams between OpenClaw and the Cursor agent binary (/home/node/.local/bin/agent acp) to transparently manage:
- Authentication: Injects a
cursor_loginauthentication payload before establishing a new session. - Session Mapping: Intercepts
session/loadandsession/newrequests, seamlessly tracking and mapping OpenClaw's requestedsessionIdto Cursor's internally generatedsessionId. - Message Queuing: Buffers incoming prompts until the session initialization finishes.
Debugging output (traffic dumps like IN_FROM_ACPX, OUT_TO_CURSOR) is optional and disabled by default.
To enable logging, you must set the CURSOR_ACP_WRAPPER_LOG environment variable to the absolute path of the desired log file (e.g., /tmp/cursor-acp.log).
This script is meant to be configured as the command for the cursor agent in your ~/.acpx/config.json. You can optionally supply the env block to enable logging.
{
"defaultAgent": "cursor",
"defaultPermissions": "approve-all",
"agents": {
"cursor": {
"command": "/path/to/cursor-acp-wrapper/cursor-acp-wrapper.js",
"runtime": "acp",
"description": "Cursor AI development agent (Wrapped)",
"env": {
"CURSOR_ACP_WRAPPER_LOG": "/tmp/cursor-acp.log"
}
}
}
}Make sure the script is executable:
chmod +x cursor-acp-wrapper.jsThis project is licensed under the Public Domain (Unlicense).