Skip to content

teach-mode: learn-from-demonstration → compiled skill (the one real gap vs Grok Bot) #1

Open

Description

@wolfqing

Grok Bot's only headline feature with no open equivalent in this stack: watch the operator perform a workflow (browser demonstration), then persist it as something a teammate can run again.

Updated 2026-10-30. This issue predates the v0.2 rewrite and originally described compiling demonstrations into an OpenClaw SKILL.md. OpenGrokBot has had its own core since v0.2 (a gateway, a web client, one container per teammate; the old recipe is kept in docs/openclaw-recipe), so the artifact is now native. The shape below reflects that; the direction is the one @bferanmi806-sketch laid out in the comments.

Proposed shape

  1. Record: the operator drives the teammate's own persistent Chromium through the computer panel (noVNC), exactly as today. The gateway already holds a Playwright/CDP connection to that browser; instrument it to capture semantic events (navigation, click, input, select) rather than pixels or raw DOM mutations. Input into password or otherwise secret fields is recorded as "a value was entered here", never the value itself.
  2. Compile: turn the trace into a small typed workflow (intent, steps with locators and expected page states), stored with the teammate the way memory and routines are. No generated JavaScript: the model writes the intent and step descriptions, the recorder supplies the mechanics.
  3. Replay with judgment: run the deterministic steps first; when a locator or page has drifted, hand that step to the agent with the recorded intent, let it continue, and offer to re-record the step afterwards.
  4. Routines run workflows: a workflow describes how; a routine (cron, webhook or watch) decides when. Approvals, standing rules and the action log apply to a replayed step exactly as to any other tool call.

Non-goals (v1): cross-app desktop recording, mobile, exporting workflows to other tools.

Prior art to evaluate: Playwright codegen (event capture, locator generation), rrweb (the event model, not the replay), WebArena-style trace formats, and the shared-skill playbooks already in <data>/skills/ as the human-readable half.

Suggested slices, each its own PR: recorder + trace format → deterministic workflow runner → agent fallback and routine integration. A short design note on the trace schema before the first slice would be ideal.

If you want this to exist, 👍 the issue or comment with your workflow — the first three concrete recorded-workflow examples will shape the trace format.

Maintainer note: design discussion welcome before any code; this issue is the roadmap anchor linked from the README.

Activity

  1. bferanmi806-sketch commented on Aug 16, 2026

    @bferanmi806-sketch
    Contributor

    I’d love to work on this. I traced the current v0.2 path from the computer panel through the Docker/noVNC browser, the gateway’s Playwright CDP connection, routines, and the agent tool loop before proposing an implementation.

    One thing I wanted to confirm first: this issue predates the v0.2 self-built-core merge and still describes compiling demonstrations into an OpenClaw SKILL.md. Current main no longer appears to have an OpenClaw skill runtime, so I think the record → compile → deterministic replay goal still fits, but the artifact probably wants to be native to OpenGrokBot now.

    My current direction would be:

    • record against the bot’s existing persistent Chromium while the operator drives it through the current noVNC panel, rather than launch a second Codegen browser;
    • instrument the existing Playwright/CDP context to capture semantic navigation/click/input/select events;
    • compile those into a small typed workflow rather than arbitrary generated JS;
    • never persist password/secret input values;
    • replay deterministic steps first, then hand control to the agent only when a locator/page has drifted;
    • keep learned workflows separate from routines: a workflow describes how, while a routine can later schedule when it runs.

    I’d probably split it into recorder/trace foundation → deterministic workflow runner → agent/routine integration rather than land teach-mode as one large PR.

    Does that match where you want #1 to go after the v0.2 rewrite? If so, I’m happy to take the first slice

  2. wolfqing commented on Oct 30, 2026

    @wolfqing
    OwnerAuthor

    Thanks for the thorough read, and sorry for the long silence. Yes, your direction matches where #1 should go after the v0.2 rewrite: record against the bot's own persistent Chromium through the existing CDP context, compile into a small typed workflow rather than generated JS, never persist secret input, replay deterministically and hand off to the agent on drift, and keep workflows ("how") separate from routines ("when"). Splitting it into recorder/trace → deterministic runner → agent/routine integration is the right shape too.

    I've refreshed the issue body to drop the OpenClaw SKILL.md framing. If you're still interested, the first slice (recorder + trace format) is yours; a short design note on the trace schema before code would be ideal.

  3. bferanmi806-sketch commented on Oct 31, 2026

    @bferanmi806-sketch
    Contributor

    Trace schema v1

    I propose keeping a recorded workflow as a versioned, typed JSON document, separate from routines. A workflow describes how to do something; a routine may later decide when to run it. The first slice records traces only and does not add replay or scheduling.

    type WorkflowTrace = {
      format: 'opengrokbot.workflow'
      version: 1
      title: string
      steps: WorkflowStep[]
    }
    
    type Locator = {
      role?: { name: string; role: string }
      label?: string
      placeholder?: string
      text?: string
      testId?: string
      css?: string // last-resort fallback
    }
    
    type WorkflowStep =
      | { type: 'navigate'; url: string }
      | { type: 'click'; target: Locator }
      | { type: 'fill'; target: Locator; value: { kind: 'literal'; text: string } | { kind: 'redacted'; reason: 'sensitive-input' } }
      | { type: 'select'; target: Locator; value: { kind: 'literal'; text: string } | { kind: 'redacted'; reason: 'sensitive-input' } }

    The recorder should attach to the teammate's existing persistent Chromium Page supplied by the shared BrowserSession; it must not launch a second browser or replace the logged-in context. A recording session explicitly starts and stops event capture on that page. Each action stores semantic locators in a resilient preference order (role/name, label, placeholder, test id, then CSS), without generating executable JavaScript.

    Redaction is enforced before serialization. Password and one-time-code fields, sensitive autocomplete values, and fields whose accessible/name metadata indicates a password, secret, token, or API key produce a redacted fill/select step with no input value. Navigation URLs lose user-info and fragments; query values are omitted by default so session tokens cannot leak through URLs. The trace never stores page text, screenshots, cookies, or other browser state.

    The format leaves room for later deterministic replay: locator candidates are tried in order, and a redacted step can ask the operator for a value at replay time. That runner and routine integration remain out of this first slice. If this shape fits, I’ll proceed with the recorder and schema validation/tests only.

  4. wolfqing commented on Nov 1, 2026

    @wolfqing
    OwnerAuthor

    Thanks — this is a clear note, and the overall shape is right: one document per workflow with a version number, a recorder that attaches to the teammate's existing browser, redaction before anything is written, and no generated JS. Please go ahead with the recorder and schema slice. A few things I'd like folded in first:

    1. Build on v0.4.0. A teammate's computer can now be local, not only Docker. Since your note, v0.4.0 added local computers: on macOS and Linux a teammate can get a browser on the host instead of a container. Both kinds share BrowserSession (gateway/src/browser-page.ts), so attaching to session.page() works for both. Two things differ for recording:

    • On a local computer the panel only shows a CDP screencast, which you can watch but not click or type into. The operator drives the real window instead, the one showWindow() opens for sign-in. So recording on a local computer means showing that window first.
    • showWindow() / hideWindow() close the browser and reopen it with or without a window (see relaunch in computer-local.ts), so the Page you attached to is gone afterwards. The recorder needs to re-attach after a relaunch, or recording needs to stop cleanly when one happens.

    Please test both Docker and local computers.

    2. A few more step types, or at least room for them. navigate/click/fill/select cover a lot, but real workflows quickly need:

    • press (Enter to submit a search box is the common case)
    • check / uncheck
    • clicks that open a new tab or popup
    • actions inside an iframe

    Leaving some of these out of v1 is fine, as long as the format can add them without a version bump. Maybe that means an optional frame / page reference on every step.

    3. Make the locator candidates an ordered list. "Tried in order" is really a property of the list, so target: { candidates: Locator[] } (most stable first, each candidate one strategy) says it directly. A single object with optional fields leaves the order to whoever reads it.

    4. Leave room for intent now. The compile step will add each step's intent and the page state it expects, and the agent fallback depends on both. An optional intent?: string on every step (and on the trace) costs nothing now and avoids a v2 later.

    5. Literal values are still personal data. Redacting secrets is right, but a fill with an email address or a street address is still stored as is. Before saving, please show the operator what was captured (even a plain step list), so they can turn any value into a placeholder or drop a step. Recording query keys with their values removed, so a replay knows which parameters were there, also sounds good.

    6. Two small scope questions.

    • Storage: everything else a teammate owns (routines, approvals, the action log) lives in SQLite (gateway/src/db.ts). A workflows table next to routines would match that.
    • UI: does this slice include start/stop controls in the computer panel, or only the API? Either is fine; just say which in the PR.

    Happy to review the PR as soon as it's ready.

  5. wolfqing commented on Nov 16, 2026

    @wolfqing
    OwnerAuthor

    Quick status update here since Slice 1 (#11) landed:

    • Done (feat(gateway): record typed browser workflows #11): typed trace schema (v1), recorder attached to BrowserSession across Docker and local browser relaunches, sensitive-input and URL query redaction, in-memory review draft API (drop steps / turn values into placeholders), and the SQLite workflows table.
    • Still open for teach-mode: learn-from-demonstration → compiled skill (the one real gap vs Grok Bot) #1:
      1. Deterministic workflow runner — step through a saved workflow on BrowserSession using the ordered locator candidates, bind placeholder/redacted inputs at run time, and route outbound/state-changing steps through the existing approval gate and action log.
      2. Computer-panel UI — start/stop recording, review & edit captured steps before saving, and trigger a saved workflow.
      3. Compile, drift fallback & routines — populate step/trace intent, hand off to the agent when a locator or page state drifts, and allow routines to run a workflow.

    (Note if you pull fresh main: the project has since been renamed to OpenSuperBot in v0.5.0 and added the desktop/ shell in v0.6.0, while gateway/src/workflow-recorder.ts and gateway/src/workflows.ts remain in the same place.)

    @bferanmi806-sketch thanks again for the clean foundation in #11 — if you're up for taking the next slice (either the deterministic runner or the panel UI), let me know! A short note on placeholder binding and approval gating before code would be great.

  6. bferanmi806-sketch commented on Nov 16, 2026

    @bferanmi806-sketch
    Contributor

    Thanks for the update and for merging #11! I'd be happy to take the deterministic workflow runner next.

    My approach would be to execute saved traces through the existing "BrowserSession", resolve locators in their recorded order, and bind placeholders or redacted inputs at runtime without persisting sensitive values.

    I'd also reuse the existing approval gate and action log for state-changing actions, stopping execution cleanly when a step fails or approval is denied.

    I'll keep this slice focused on the runner and its tests, leaving UI, agent fallback and routines for later.

    One question before starting: should each replayed action follow the existing approval rules, or should workflows have their own approval mechanism? I'd lean towards reusing the existing rules.

  7. wolfqing commented on Nov 17, 2026

    @wolfqing
    OwnerAuthor

    Definitely reuse the existing approval gate (gateway/src/approvals.ts) and action log (gateway/src/actions.ts) rather than introducing a separate workflow-only approval store — the operator should have one approval card in the thread and one standing-rules list (bot_id + kind + target) in the computer panel.

    Two implementation details worth keeping in mind as you wire it up:

    1. Declaring which step gates on approval: In normal turns the model calls hold_for_approval({ action, detail, kind, target }), whereas deterministic steps don't invoke the LLM. Adding optional approval metadata on state-changing steps (e.g. approval?: { kind: ApprovalKind; target: string; action?: string } set during review/save, with rulesAllowed true only for operator-initiated runs without external/webhook payloads, matching server.ts) keeps the schema explicit without guessing DOM semantics. Note also that only RULEABLE_KINDS (email, message, post) match standing rules; purchase, booking, and other always ask.
    2. Resuming after /api/approvals/:id: Today settleApproval() in gateway/src/server.ts unconditionally starts a new LLM turn (startTurn(...)) once the operator approves or discards. For a deterministic workflow run paused at step k, you'll want settleApproval to check for a pending workflow continuation keyed by approvalId first — resuming from step k on approve (without persisting bound secret/placeholder values) or stopping cleanly on discard — and only fall back to startTurn for regular agent approvals.

    Note: DELETE /api/bots/:botId/workflows/:workflowId just landed on main alongside v0.6.1 as well. Feel free to open a PR whenever the runner + tests are ready!

  8. wolfqing commented on Nov 19, 2026

    @wolfqing
    OwnerAuthor

    Slice 2 (#34 — deterministic replay runner) has landed on main:

    Thanks @bferanmi806-sketch for landing both #11 and #34! Let me know if you'd like to take either the panel UI slice or the compile/drift/routine slice next.

  9. bferanmi806-sketch commented on Nov 19, 2026

    @bferanmi806-sketch
    Contributor

    Thanks for the invitation. I’ll take the computer-panel UI slice: start and stop recording, review and edit the captured draft (drop steps, turn values into placeholders, and set approval annotations), save it, and run or stop saved workflows.

    I’ll build on the existing workflow APIs, keep the English and Chinese strings in sync, and add coverage for the recording, review, and run states. I’ll leave agent fallback and routine triggers for a later slice.

  10. wolfqing commented on Nov 21, 2026

    @wolfqing
    OwnerAuthor

    Sounds great — the computer-panel UI slice is yours! Three small notes that should save some friction as you wire it up:

    1. Base on fresh main (v0.7.0). v0.7.0 just landed Connectors → Apps and Connectors → MCP sections in web/src/components/ComputerPanel.tsx and web/src/i18n/, so branching off current main will avoid panel/i18n conflicts.
    2. Surviving a panel reopen or page reload. Today GET /api/bots/:botId/computer only returns workflowRecording: boolean and workflowDraft: boolean. Including the pending draft ({ id, trace } when workflowDraft is present) and active run metadata (workflowRun: { runId, workflowId } | null — never runtime bindings) in that status response (or equivalent GET routes) will let the panel restore review/stop controls cleanly after a reload.
    3. Local computers (kind === 'local'). On local computers the panel's CDP screencast is watch-only, while the operator interacts with the real browser window (POST /api/bots/:botId/computer/window with { "shown": true }). Opening that window when recording starts on a local computer (or surfacing a one-click prompt right in the recording bar) will make local recording as straightforward as Docker's interactive noVNC view.

    Looking forward to reviewing the PR when it's ready!

  11. wolfqing commented on Nov 25, 2026

    @wolfqing
    OwnerAuthor

    Slice 3 (#36 — computer-panel workflow controls) has landed on main:

    Huge thanks again @bferanmi806-sketch for shipping #11, #34, and #36! Let me know if you'd like to take the final agent-fallback & routine-trigger slice as well.

  12. bferanmi806-sketch commented on Nov 25, 2026

    @bferanmi806-sketch
    Contributor

    Thanks for merging #36 and for the invitation. I’m interested in the final slice. Would you be open to a PR for trace intent and agent fallback on locator or URL drift, followed by a separate PR for routine triggers?

  13. wolfqing commented on Nov 27, 2026

    @wolfqing
    OwnerAuthor

    Splitting the final slice into those two PRs makes complete sense — go for it!

    Three invariants worth keeping in mind for the first PR (intent + agent drift fallback) on top of current main:

    1. Drift vs. fail-closed errors: Only hand off to the agent on genuine page/locator drift (target_not_found or url_mismatch). Security and environment stops (popup_opened, vault_denied, vault_domain_mismatch, cancelled, browser_unavailable) should still stop immediately and fail closed without invoking the model.
    2. Never leak runtime bindings or Vault secrets into prompts/messages: When handing off at step k, pass the workflow/step intent, step index, and safe locator/URL context — never serialize caller-supplied bindings (placeholders / redacted inputs) or resolved Vault credentials into thread messages, action logs, or model context.
    3. Preserve turn origin & guardrails: When the fallback starts or continues an agent turn on the pinned workflowPage(), keep the caller's origin / rulesAllowed constraints (and action-guardrail checks on main) intact so a drifted step cannot bypass approval rules.

    Looking forward to the PR!

  14. bferanmi806-sketch commented on Nov 27, 2026

    @bferanmi806-sketch
    Contributor

    Thanks for confirming the split and for spelling out the safety rules. I’ll keep this first PR focused on saved intent and page-drift handoff, with popup, Vault, cancellation, and browser failures still stopping immediately. The fallback will use the pinned page and existing guardrails, and it won’t receive runtime bindings or Vault values. I’ll leave routine triggers for the separate follow-up.

  15. wolfqing commented on Nov 29, 2026

    @wolfqing
    OwnerAuthor

    Page-drift handoff (#40) has landed on main:

    • Drift fallback on pinned page: target_not_found (locator timeout) and url_mismatch now hand off to a browser-only agent continuation on the workflow's pinned page with sanitized workflow title, workflow/step intent, and locator/URL context, while popup_opened, Vault errors, cancellation, closed pages, and browser/action errors still fail closed immediately.
    • Secret & binding isolation: Runtime bindings and resolved Vault secrets stay out of prompts, URLs, native tool-call replay blocks, repeat-guard previews, persisted guardrail approvals, thread messages, and action logs (browser_fill_secret, screenshots, shell, and non-browser tools are disabled during handoff).
    • Guardrails & origin pinning: Fallback runs with allowStandingRules: false and tainted: true, preserves deterministic computer action guardrails, and re-verifies expectedOrigin on the pinned page before executing an approved browser action.

    That leaves the final slice — routine triggers running saved workflows — clear to build on top of current main whenever you're ready, @bferanmi806-sketch!

  16. bferanmi806-sketch commented on Nov 30, 2026

    @bferanmi806-sketch
    Contributor

    Thanks for merging #40 and for keeping the split clear. The page-drift handoff now on main gives the remaining work a clean boundary. I’m interested in taking the routine-trigger slice next. I have a few current commitments still open, so I’m leaving #1 unclaimed for now; once one clears, I’ll check that the slice is still available before starting.

  17. wolfqing commented on Dec 1, 2026

    @wolfqing
    OwnerAuthor

    Sounds good — thanks again for all the great work across the workflow slices, and appreciate you keeping #1 open in the meantime! No rush at all; just drop a quick note here whenever your schedule clears up, @bferanmi806-sketch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions