AgentCraft Event Reporting
AgentCraft visualizes your coding sessions as an RTS game. Follow these steps to ensure AgentCraft is running and to report your activity.
1. Check if AgentCraft is Running
CODEBLOCK0
If this returns JSON with "status":"ok", skip to step 3.
2. Deploy if Needed
If the health check fails (server not running), start it in the background:
CODEBLOCK1
Wait a few seconds, then verify:
CODEBLOCK2
If it still fails, proceed with your task without reporting — silently ignore all AgentCraft errors.
3. Generate a Session ID
Use a deterministic ID based on your workspace path:
CODEBLOCK3
On macOS (if md5sum is unavailable):
CODEBLOCK4
Use this same AGENTCRAFT_SESSION for all events in this session.
4. Report Events
POST events to http://localhost:2468/event at these moments. Use curl — fire-and-forget, do not block on the response.
Starting work (hero_active)
When you begin processing a user prompt:
CODEBLOCK5
Mission start (mission_start)
Immediately after hero_active, report the mission with the user's prompt:
CODEBLOCK6
File access (file_access)
When you read, write, or edit a file:
CODEBLOCK7
Set operation to "read", "write", or "edit". For edits, set linesAdded and linesRemoved to actual counts.
Shell commands (bash_command)
When you execute a shell command:
CODEBLOCK8
Done / idle (hero_idle)
When you finish processing and are waiting for the next prompt:
CODEBLOCK9
Rules
- - Use
curl to POST — fire-and-forget (&>/dev/null &), do not block on the response. - Always set
client to "openclaw". - Use the same
AGENTCRAFT_SESSION value for all events in a session. - Set
cwd to the current working directory. - Do not report the same action more than once.
- If the AgentCraft server is not reachable, silently ignore errors — do not retry or log failures.
Inviting Other Agents
Other OpenClaw agents can join your AgentCraft dashboard without installing this skill.
Quick join (same machine)
Share these curl commands with other agents. They only need to generate their own session ID and POST events:
CODEBLOCK10
Share with remote agents
To let agents on other machines join:
- 1. Expose your AgentCraft server:
CODEBLOCK11
- 2. Share the resulting
https://xxx.trycloudflare.com URL.
- 3. Remote agents replace
localhost:2468 with that URL in all event curl commands.
AgentCraft 事件报告
AgentCraft 将你的编码会话可视化为即时战略游戏。请按照以下步骤确保 AgentCraft 正在运行并报告你的活动。
1. 检查 AgentCraft 是否正在运行
bash
curl -sf http://localhost:2468/health
如果返回包含 status:ok 的 JSON,则跳至步骤 3。
2. 如有需要则部署
如果健康检查失败(服务器未运行),在后台启动它:
bash
npx -y @idosal/agentcraft start --no-browser -d
等待几秒钟,然后验证:
bash
curl -sf http://localhost:2468/health
如果仍然失败,则继续执行任务而不进行报告——静默忽略所有 AgentCraft 错误。
3. 生成会话 ID
使用基于工作区路径的确定性 ID:
bash
AGENTCRAFTSESSION=openclaw$(echo -n $PWD | md5sum | head -c 12)
在 macOS 上(如果 md5sum 不可用):
bash
AGENTCRAFTSESSION=openclaw$(echo -n $PWD | md5 | head -c 12)
在此会话的所有事件中使用相同的 AGENTCRAFT_SESSION。
4. 报告事件
在以下时刻向 http://localhost:2468/event 发送 POST 请求。使用 curl —— 发送后即忘,不要阻塞等待响应。
开始工作(hero_active)
当你开始处理用户提示时:
bash
curl -sf -X POST http://localhost:2468/event \
-H Content-Type: application/json \
-d {\type\:\heroactive\,\sessionId\:\$AGENTCRAFTSESSION\,\client\:\openclaw\,\cwd\:\$PWD\} &>/dev/null &
任务开始(mission_start)
在 hero_active 之后立即报告任务及用户提示:
bash
curl -sf -X POST http://localhost:2468/event \
-H Content-Type: application/json \
-d {\type\:\missionstart\,\sessionId\:\$AGENTCRAFTSESSION\,\client\:\openclaw\,\missionId\:\mission_$(date +%s)\,\name\:\<提示的前50个字符>\,\prompt\:\<完整用户提示>\,\cwd\:\$PWD\} &>/dev/null &
文件访问(file_access)
当你读取、写入或编辑文件时:
bash
curl -sf -X POST http://localhost:2468/event \
-H Content-Type: application/json \
-d {\type\:\fileaccess\,\sessionId\:\$AGENTCRAFTSESSION\,\client\:\openclaw\,\filePath\:\<绝对文件路径>\,\operation\:\read\,\linesAdded\:0,\linesRemoved\:0,\cwd\:\$PWD\} &>/dev/null &
将 operation 设置为 read、write 或 edit。对于编辑操作,将 linesAdded 和 linesRemoved 设置为实际计数。
Shell 命令(bash_command)
当你执行 shell 命令时:
bash
curl -sf -X POST http://localhost:2468/event \
-H Content-Type: application/json \
-d {\type\:\bashcommand\,\sessionId\:\$AGENTCRAFTSESSION\,\client\:\openclaw\,\command\:\<命令,最多200个字符>\,\cwd\:\$PWD\} &>/dev/null &
完成/空闲(hero_idle)
当你完成处理并等待下一个提示时:
bash
curl -sf -X POST http://localhost:2468/event \
-H Content-Type: application/json \
-d {\type\:\heroidle\,\sessionId\:\$AGENTCRAFTSESSION\,\client\:\openclaw\} &>/dev/null &
规则
- - 使用 curl 发送 POST 请求——发送后即忘(&>/dev/null &),不要阻塞等待响应。
- 始终将 client 设置为 openclaw。
- 在会话的所有事件中使用相同的 AGENTCRAFT_SESSION 值。
- 将 cwd 设置为当前工作目录。
- 不要重复报告同一操作。
- 如果 AgentCraft 服务器无法访问,静默忽略错误——不要重试或记录失败。
邀请其他代理
其他 OpenClaw 代理可以加入你的 AgentCraft 仪表板,无需安装此技能。
快速加入(同一台机器)
与其他代理分享这些 curl 命令。他们只需要生成自己的会话 ID 并发送 POST 事件:
bash
生成唯一的会话 ID(在 macOS 上使用 md5 代替 md5sum)
AGENTCRAFT
SESSION=openclaw$(echo -n $PWD | md5sum | head -c 12)
报告活跃状态
curl -sf -X POST http://localhost:2468/event \
-H Content-Type: application/json \
-d {\type\:\hero
active\,\sessionId\:\$AGENTCRAFTSESSION\,\client\:\openclaw\,\cwd\:\$PWD\} &>/dev/null &
完成后报告空闲状态
curl -sf -X POST http://localhost:2468/event \
-H Content-Type: application/json \
-d {\type\:\hero
idle\,\sessionId\:\$AGENTCRAFTSESSION\,\client\:\openclaw\} &>/dev/null &
与远程代理共享
要让其他机器上的代理加入:
- 1. 暴露你的 AgentCraft 服务器:
bash
cloudflared tunnel --url http://127.0.0.1:2468
- 2. 分享生成的 https://xxx.trycloudflare.com URL。
- 3. 远程代理在所有事件 curl 命令中将 localhost:2468 替换为该 URL。