--- name: rrweb-sgrobot-adapter description: Generate SGrobot-compatible PlanTemplate.toml and runtime SKILL.toml artifacts from rrweb semantic traces. Use when adapting recorded browser workflows, rrweb traces, semantic-trace JSON, or browser automation recordings for SGrobot/sgclaw plan_templates and .sgclaw-workspace skills without changing SGrobot core. --- # RRWeb SGrobot Adapter Use this skill to turn one rrweb semantic trace into SGrobot runtime artifacts: ```text plan_templates//PlanTemplate.toml .sgclaw-workspace/skills/-execute/SKILL.toml .sgclaw-workspace/skills/-execute/scripts/execute_trace.js .sgclaw-workspace/skills/-execute/trace.semantic.json ``` Do not treat `SKILL.md` as the SGrobot runtime artifact. In SGrobot: - `PlanTemplate.toml` is the user-facing business task orchestration. - `.sgclaw-workspace/skills/**/SKILL.toml` is the executable runtime skill. - `.agents/skills/**/SKILL.md` is only an agent/Codex helper. ## Workflow 1. Read the semantic trace JSON and confirm it has `id`, `name`, `startUrl`, and non-empty `steps`. 2. Read [references/sgrobot-adapter.md](references/sgrobot-adapter.md) when you need SGrobot mapping details. 3. Generate artifacts with: ```bash node scripts/generate_sgrobot_flow.mjs \ --trace examples/basic-trace.json \ --out /path/to/sgrobot-architecture-design \ --default-mode dry-run ``` Use `--default-mode execute` only when the user explicitly wants the generated skill to mutate the target page. Generated execute-mode plans set `requires_approval = true` when the trace includes mutating actions. 4. Inspect the generated `PlanTemplate.toml` and `SKILL.toml` before handing off. The plan step `skills = ["..."]` must match the generated `[skill].name`. 5. In a live SGrobot repo, verify `/api/debug/plans` sees the plan and `/api/skill` sees the skill before running the digital employee task. ## Trace Shape Minimal trace: ```json { "id": "expense-approval", "name": "费用审批", "description": "打开审批页,填写意见并点击同意。", "startUrl": "https://oa.example.test/expense/123", "steps": [ { "type": "assertText", "text": "费用审批", "label": "确认在审批页" }, { "type": "fill", "selector": "textarea[name='comment']", "value": "同意", "label": "填写审批意见" }, { "type": "click", "selector": "button[data-action='approve']", "label": "点击同意", "risk": "write" } ] } ``` Supported first-version action types are `assertText`, `extractText`, `click`, `fill`, `input`, `type`, `select`, `check`, `uncheck`, and `submit`. Prefer stable CSS selectors; XPath is supported with `xpath=` or leading `//`.