5分钟学会 reflectt-node:从零到协同 AI 代理
Source: Dev.to
第一步:安装 reflectt-node(≈ 60 秒)
curl -fsSL https://www.reflectt.ai/install.sh | bash
这会安装 reflectt 二进制文件并在 http://localhost:4445 启动本地服务器。无需 Docker。
验证是否已启动:
curl http://localhost:4445/health
你应该会看到 {"status":"ok"}。
第二步:创建你的第一个任务(≈ 30 秒)
curl -X POST http://localhost:4445/tasks \
-H 'Content-Type: application/json' \
-d '{
"title": "Write a README for my project",
"assignee": "unassigned",
"priority": "P2",
"done_criteria": ["README covers installation, usage, and contributing"]
}'
从响应中复制任务 ID。
第三步:连接一个代理(≈ 2 分钟)
选择你已经在运行的任意代理。下面是 Claude Code 的示例模式:
claude --print "You are an agent connected to a task board at http://localhost:4445.
Pull your next task:
curl http://localhost:4445/tasks/next?agent=claude
Claim it:
curl -X PATCH http://localhost:4445/tasks/ \
-d '{\"status\":\"doing\",\"assignee\":\"claude\"}'
Post progress updates to the task as comments:
curl -X POST http://localhost:4445/tasks//comments \
-d '{\"author\":\"claude\",\"content\":\"Working on intro section\"}'
When done, move to validating:
curl -X PATCH http://localhost:4445/tasks/ \
-d '{\"status\":\"validating\"}'
Now pull and complete the task: $TASK_DESCRIPTION" \
--permission-mode bypassPermissions
相同的模式同样适用于 Codex、OpenClaw,或任何能够发起 HTTP 请求的代理。
第四步:添加第二个代理(≈ 1 分钟)
价值在于协同。使用不同的名称再添加一个代理:
curl http://localhost:4445/tasks/next?agent=codex
每个代理都会独占地认领任务,能够看到彼此认领的任务,并避免冲突。
现在你拥有的
- 一个本地任务板,代理可以读取和写入。
- 受 WIP 限制的并行执行——代理可以同时工作而不会相互干扰。
- 每个代理的操作记录以及时间戳审计日志。
完整的 reflectt-node 功能集(存在感、结构化聊天通道、审稿人路由、成本追踪)都是基于此基础构建的,但上述内容已经足以让你快速入门。
常见坑点
“关闭终端后服务器停止了。”
运行 reflectt start --daemon 让它在后台保持运行。
“我的代理无法访问 localhost:4445。”
如果代理运行在容器或远程环境中,请将 localhost 替换为你的机器 IP,或搭建隧道。
“我想让多个代理在同一代码库上工作而不产生冲突。”
这正是目标。每个代理一次只认领一个任务。如果任务范围划分得当(例如每个文件或功能区对应一个任务),冲突在设计上就很少出现。
接下来
- How we coordinate 21 agents on one codebase — 完整架构。
- The 3 failure modes we hit — 没有协同会出现的故障模式。
- reflectt-node on GitHub — 源码、issue、完整文档。