Browser Demo Recorder
Turn a natural-language recording request into a deterministic browser recording that lands in the current workspace media/ directory and can be sent back immediately.
Workflow
- 1. Extract the recording brief into a concrete sequence.
- Convert the sequence into a JSON plan.
- Run
scripts/run-recording.mjs against that plan. - Verify the MP4 exists in the current workspace
media/ directory. - Reply with a short status line and a
MEDIA: line pointing at the generated file.
What to Capture From the User Brief
Convert the request into these fields before recording:
- - Start URL and any required destination URLs
- Viewport preference if given; otherwise use INLINECODE4
- Ordered steps: page holds, cursor sweeps, clicks, typing, scrolls, and ending frame
- Timing goals: total duration, per-step hold times, and any "don't click" / "hover only" constraints
- Output basename if the user hints at a name; otherwise derive a short slug from the task
If the brief is missing something critical, ask one question. Otherwise infer sensible defaults and proceed.
Plan Format
Read references/plan-schema.md when building or debugging plans.
Use references/example-skills-video-plan.json as the default reference for a multi-step marketing demo with homepage, hub, search, and return-home flow.
Runner
Run the recorder like this:
CODEBLOCK0
Behavior:
- - Connects to the existing OpenClaw browser via CDP
- Injects a visible cursor overlay so recordings show mouse position
- Uses human-like mouse movement, clicks, typing, and wheel-based scrolling
- Records directly to MP4
- Writes both MP4 and debug JSON into the plan's INLINECODE7
- Default output directory should be the current workspace
media/ directory
Output Rules
Always set the plan outputDir to the workspace media directory unless the user explicitly asks for a different safe location.
After success:
- 1. Mention the generated file path briefly.
- Put the attachment on its own line using the MEDIA protocol.
Example reply shape:
CODEBLOCK1
Use a workspace-relative MEDIA: path when possible.
Implementation Notes
- - Homepage forms sometimes open a new tab; if that breaks a continuous recording, add an
evaluate step that changes the form target to _self before clicking submit. - Prefer DOM-based targets over raw coordinates, but use coordinates for cinematic cursor sweeps.
- Keep cursor motion smooth and leave short holds after major transitions so the video is usable with voiceover.
- Save the generated plan near the media output or in a temp location only if you need to inspect it again; the MP4 in
media/ is the primary artifact. - If the run fails, inspect the debug JSON written next to the output video before retrying.
Browser Demo Recorder
将自然语言的录制请求转化为确定性的浏览器录制,并保存到当前工作空间的 media/ 目录中,且可立即发送。
工作流程
- 1. 将录制需求提取为具体的操作序列。
- 将操作序列转换为 JSON 计划。
- 根据该计划运行 scripts/run-recording.mjs。
- 验证当前工作空间 media/ 目录中存在 MP4 文件。
- 回复简短的状态行,并附带指向生成文件的 MEDIA: 行。
从用户需求中提取的内容
在录制前,将请求转换为以下字段:
- - 起始 URL 及任何必要的目标 URL
- 视口偏好(若提供);否则使用 1600x1200
- 有序步骤:页面停留、光标扫动、点击、输入、滚动及结束帧
- 时间目标:总时长、每步停留时间,以及任何“不要点击”/“仅悬停”的限制
- 输出文件名(若用户提示了名称);否则根据任务生成简短标识
如果需求中缺少关键信息,则提出一个问题。否则推断合理的默认值并继续执行。
计划格式
构建或调试计划时,请阅读 references/plan-schema.md。
使用 references/example-skills-video-plan.json 作为包含首页、中心页、搜索及返回首页流程的多步骤营销演示的默认参考。
运行器
按如下方式运行录制器:
bash
node scripts/run-recording.mjs /absolute/path/to/plan.json
行为:
- - 通过 CDP 连接到现有的 OpenClaw 浏览器
- 注入可见的光标覆盖层,使录制显示鼠标位置
- 使用类人鼠标移动、点击、输入及基于滚轮的滚动
- 直接录制为 MP4
- 将 MP4 和调试 JSON 写入计划的 outputDir
- 默认输出目录应为当前工作空间的 media/ 目录
输出规则
除非用户明确要求其他安全位置,否则始终将计划 outputDir 设置为工作空间的 media 目录。
成功后:
- 1. 简要提及生成的文件路径。
- 使用 MEDIA 协议将附件放在单独一行。
示例回复格式:
text
录好了,时长约 42 秒。
MEDIA:media/my-demo-2026-03-25T09-30-00-000Z.mp4
尽可能使用工作空间相对路径的 MEDIA: 路径。
实现说明
- - 首页表单有时会打开新标签页;如果这破坏了连续录制,请在点击提交前添加一个 evaluate 步骤,将表单目标改为 _self。
- 优先使用基于 DOM 的目标而非原始坐标,但对于电影感光标扫动可使用坐标。
- 保持光标移动平滑,并在主要过渡后短暂停留,以便视频配合旁白使用。
- 将生成的计划保存在 media 输出附近或临时位置,仅当需要再次检查时;media/ 中的 MP4 是主要产物。
- 如果运行失败,在重试前检查输出视频旁的调试 JSON。