ACP Remote
Connect to a remote ACP (Agent Client Protocol) server and execute commands using imclaw-cli.
Prerequisites
Auto-install dependencies
Before using this skill, ensure both imclaw-cli and acpx are installed. Run these commands to install them automatically:
CODEBLOCK0
Manual installation
Install acpx
CODEBLOCK1
Install imclaw-cli
From GitHub Releases:
CODEBLOCK2
Verify installation
CODEBLOCK3
Configuration
Set the remote server URL and optional auth token:
CODEBLOCK4
Or pass directly via command line.
Server Configuration
IMClaw server uses command line flags (no config file needed):
CODEBLOCK5
| Flag | Default | Description |
|---|
| INLINECODE3 | INLINECODE4 | Server host address |
| INLINECODE5 |
8080 | Server port |
|
--timeout |
30 | Default timeout in seconds |
|
--token |
"" | Authentication token (empty = no auth) |
Usage
One-shot mode (recommended)
CODEBLOCK6
Continue a session
CODEBLOCK7
Parameters
| Parameter | Description |
|---|
| INLINECODE11 | WebSocket URL of ACP server (default: ws://localhost:8080/ws) |
| INLINECODE12 |
Authentication token (if required) |
|
-p, --prompt | Prompt message (one-shot mode) |
|
--session | Session ID to continue |
|
--agent | Agent type: claude, codex, etc. (default: claude) |
|
--format | Output format: text, json, quiet (default: text) |
|
--approve-all | Auto-approve all permission requests |
|
--approve-reads | Auto-approve reads, prompt for writes (default) |
|
--deny-all | Deny all permission requests |
|
--allowed-tools | Comma-separated tool names (default: Bash,Read,Write) |
|
--cwd | Working directory |
|
--timeout | Max wait time in seconds |
|
--model | Agent model ID |
Examples
Execute shell commands on remote
CODEBLOCK8
Analyze remote codebase
CODEBLOCK9
Use with SSH tunnel
CODEBLOCK10
Secure connection with token
CODEBLOCK11
Environment Variables
For convenience, you can set these environment variables:
CODEBLOCK12
Then simply run:
CODEBLOCK13
Tips
- 1. Session reuse: Save the session ID from first response to continue conversations
- Permission control: Use
--approve-all for non-interactive automation - Output parsing: Use
--format json for programmatic consumption - Tool restrictions: Use
--allowed-tools to limit what the agent can do - Working directory: Always specify
--cwd for file operations
ACP 远程连接
连接到远程 ACP(代理客户端协议)服务器,并使用 imclaw-cli 执行命令。
前置条件
自动安装依赖
在使用此技能前,请确保已安装 imclaw-cli 和 acpx。运行以下命令自动安装:
bash
安装 acpx(ACP 协议支持)
if ! command -v acpx &> /dev/null; then
npm install -g acpx@latest
fi
安装 imclaw-cli
if ! command -v imclaw-cli &> /dev/null; then
curl -fsSL https://raw.githubusercontent.com/smallnest/imclaw/main/scripts/install.sh | bash
fi
手动安装
安装 acpx
bash
npm install -g acpx@latest
安装 imclaw-cli
通过 GitHub Releases 安装:
bash
1. 检测平台
OS=$(uname -s | tr [:upper:] [:lower:])
ARCH=$(uname -m)
[ $ARCH = x86_64 ] && ARCH=amd64
[ $ARCH = aarch64 ] && ARCH=arm64
2. 获取最新版本号
LATEST=$(curl -s https://api.github.com/repos/smallnest/imclaw/releases/latest | grep tag_name | sed -E s/.
([^]+)./\1/)
3. 下载并解压
curl -sL https://github.com/smallnest/imclaw/releases/download/${LATEST}/imclaw
${OS}${ARCH}.tar.gz | tar xz -C /tmp
4. 安装到 PATH
mkdir -p ~/bin
mv /tmp/imclaw-cli ~/bin/
chmod +x ~/bin/imclaw-cli
5. 确保 ~/bin 在 PATH 中
echo export PATH=$HOME/bin:$PATH >> ~/.bashrc # 或 ~/.zshrc
验证安装
bash
imclaw-cli --help
acpx --version
配置
设置远程服务器 URL 和可选的认证令牌:
bash
默认服务器(使用默认值时可以省略)
export IMCLAW_SERVER=ws://your-server:8080/ws
认证令牌(如果服务器需要认证)
export IMCLAW_TOKEN=your-secret-token
或通过命令行直接传递。
服务器配置
IMClaw 服务器使用命令行标志(无需配置文件):
bash
使用默认设置启动服务器
imclaw
自定义端口和认证令牌
imclaw --port 9000 --token my-secret-token
显示帮助
imclaw --help
| 标志 | 默认值 | 描述 |
|---|
| -H, --host | 0.0.0.0 | 服务器主机地址 |
| -p, --port |
8080 | 服务器端口 |
| --timeout | 30 | 默认超时时间(秒) |
| --token | | 认证令牌(空值表示无需认证) |
使用方法
单次模式(推荐)
bash
基本用法
imclaw-cli --server ws://your-server:8080/ws -p 你好
带认证令牌
imclaw-cli --server ws://your-server:8080/ws --token your-token -p 你好
使用特定代理
imclaw-cli --server ws://your-server:8080/ws --agent codex -p 分析这段代码
JSON 输出
imclaw-cli --server ws://your-server:8080/ws --format json -p 列出文件
继续会话
bash
第一条消息创建会话,返回会话 ID
imclaw-cli --server ws://your-server:8080/ws -p 阅读 README.md
使用相同会话继续
imclaw-cli --server ws://your-server:8080/ws --session
-p 总结内容
参数
| 参数 | 描述 |
|---|
| --server | ACP 服务器的 WebSocket URL(默认:ws://localhost:8080/ws) |
| --token |
认证令牌(如果需要) |
| -p, --prompt | 提示消息(单次模式) |
| --session | 要继续的会话 ID |
| --agent | 代理类型:claude、codex 等(默认:claude) |
| --format | 输出格式:text、json、quiet(默认:text) |
| --approve-all | 自动批准所有权限请求 |
| --approve-reads | 自动批准读取,写入时提示(默认) |
| --deny-all | 拒绝所有权限请求 |
| --allowed-tools | 逗号分隔的工具名称(默认:Bash、Read、Write) |
| --cwd | 工作目录 |
| --timeout | 最大等待时间(秒) |
| --model | 代理模型 ID |
示例
在远程执行 Shell 命令
bash
imclaw-cli --server ws://remote-server:8080/ws \
--agent claude \
--approve-all \
-p 运行 df -h 并显示磁盘使用情况
分析远程代码库
bash
imclaw-cli --server ws://remote-server:8080/ws \
--cwd /path/to/project \
-p 审查 main.go 文件并提出改进建议
通过 SSH 隧道使用
bash
首先创建 SSH 隧道
ssh -L 8080:localhost:8080 user@remote-server -N &
通过 localhost 连接
imclaw-cli --server ws://localhost:8080/ws -p 来自远程的问候
使用令牌的安全连接
bash
配置了 auth_token 的服务器
imclaw-cli \
--server wss://secure-server:8080/ws \
--token your-secret-token \
-p 执行分析任务
环境变量
为方便起见,可以设置以下环境变量:
bash
在 ~/.bashrc 或 ~/.zshrc 中
export IMCLAW_SERVER=ws://your-server:8080/ws
export IMCLAW_TOKEN=your-token
然后直接运行:
bash
imclaw-cli --server $IMCLAWSERVER --token $IMCLAWTOKEN -p 你好
提示
- 1. 会话复用:保存首次响应的会话 ID 以继续对话
- 权限控制:使用 --approve-all 进行非交互式自动化
- 输出解析:使用 --format json 进行程序化处理
- 工具限制:使用 --allowed-tools 限制代理可执行的操作
- 工作目录:文件操作时始终指定 --cwd