Agent 接入
让 curxor 把选中的元素直接交给 Agent 改代码。内置 Claude Code、Cursor、Pi;任何 ACP 兼容的 Agent 都能接入。
先分清两条接入路径:MCP 面向外部编辑器,把选中元素的上下文交给编辑器里的 AI;Agent 面向 curxor 侧边栏,直接驱动 Agent 改代码。两者互不影响,可以同时用。
配置 agents.toml
Agent 由 ~/.curxor/agents.toml 配置,首次启动自动写入下面三个内置项;之后直接改这个文件,保存后下一次请求生效:
toml
[[agents]]
id = "claude"
name = "Claude Code"
command = "npx"
args = ["-y", "@agentclientprotocol/claude-agent-acp@latest"]
probe = "claude"
[[agents]]
id = "cursor"
name = "Cursor"
command = "cursor-agent"
args = ["acp"]
probe = "cursor-agent"
[[agents]]
id = "pi"
name = "Pi"
command = "npx"
args = ["-y", "@curxor/pi-acp@latest"]
probe = "pi"
env = { PI_ACP_KEEP_ALL_SESSIONS = "true" }
permissions = false
| 字段 | 含义 |
|---|---|
| id | 唯一标识,请求时用它定位 Agent |
| name | 「选择 Agent」菜单里的显示名 |
| command / "args" | 把该 Agent 启动为 ACP server 的命令,args 是它的参数 |
| probe | 检测「是否已安装」的二进制,未设置时回退到 command。Claude Code 的 command 是 npx(恒存在),必须靠 probe = "claude" 才能判断准确 |
| env | 启动 Agent 进程时额外注入的环境变量(可选) |
| permissions | 该 Agent 是否支持权限确认。pi 没有权限弹窗,配 false 后隐藏权限确认 UI(默认 true) |
Curxor 只按 probe 探测,不安装、也不代理各 Agent 的登录:只要对应二进制在 PATH 且鉴权完成(OAuth、API key、企业网关等方式都行),就能直接使用。
装好后,侧边栏「设置 → Agent 配置」会显示已安装,即可在「选择 Agent」菜单里使用。未安装的项仍会列出,但选择时会提示「模型加载失败」,排查方法见 排查页。
ACP 是关键:只要命令能以 ACP server 启动、用 stdin/stdout 通信,Curxor 侧无需任何改动 —— OpenCode、Trae 甚至自研 Agent 都走同一套配置。
自定义 Agent
任何支持 ACP 的 Agent,按上面的字段写一段 [[agents]] 就能接进来。例如 OpenCode:
toml
[[agents]]
id = "opencode"
name = "OpenCode"
command = "opencode"
args = ["acp"]
# env = { SOME_VAR = "value" } # 可选:传给 agent 进程的环境变量
供 AI 阅读: llms.txt · llms-full.txt