Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

13.3 KB
Raw Blame

Saved steps: repeating a computer task without AI

A bot that did a task on this computer once repeats it with no AI call when the person sends the same words again (design: saved steps).

What it proves

  • An AI run on this computer, in a conversation where the person picked this computer as the place, at Full access, saves its steps and marks its reply savedSteps.learned. The file is DATA/bots/BOT_ID/saved-steps.json, mode 0600, and holds targets by identity (app, window title, element role, label and path) and the request word for word, never tokens, pids, window ids or the AI's reply.
  • The same words replay those steps with no engine call: each target is found fresh, each action is approved through the normal Full-access handler, and the reply says what the steps did, marked savedSteps.replayed.
  • Stop during a replay ends the turn with no AI and keeps the steps.
  • Forget deletes the steps.
  • Approvals and replies name targets and keys, never the typed text.
  • A conversation that follows the bot's Auto place does not replay, though this computer is mounted at Full access and the bot has steps for those words.
  • With the switch off, the AI runs and nothing is saved, though steps exist.
  • A failed step hands the request to the AI with a note of what already happened, deletes the steps, and that request does not save even though the AI's own run is clean.

Run

Unit and route checks:

pnpm exec vitest run server/saved-steps server/routes/saved-steps.test.ts server/routes/computer-journal.test.ts server/local-computer-proxy.test.ts server/local-computer.test.ts server/delta-context.test.ts src/components/SavedStepsChip.test.ts src/components/SavedStepsRow.test.ts server/testing/fake-cua-driver.test.ts

The fixture runs on macOS. A Linux server never mounts this computer from this record, and Windows was not tried. The driver is server/testing/fake-cua-driver.ts: TextEdit's one window in cua-driver 0.28.2's answer shapes, whose element tokens (s<snapshot>-e<index>) go stale at the next get_window_state and whose document reports what it holds as its value. FAKE_CUA_STATE keeps the snapshot count and the document's text across its processes, FAKE_CUA_LOG logs each call, the next set_value on a live element while FAKE_CUA_FAIL exists fails and removes it, and actions wait while FAKE_CUA_HOLD exists.

The server reads this computer's driver record only from the desktop app, over its parent port. OMB_TEST_DESKTOP_CUA_CONNECTION makes the launcher start the server with server/testing/desktop-parent.mjs, which hands it the record the way the app does.

SCRATCH=$(mktemp -d)
cat > "$SCRATCH/calls.json" <<'EOF'
[{"server":"computer","name":"list_apps"},
 {"server":"computer","name":"list_windows","input":{"pid":4242}},
 {"server":"computer","name":"get_window_state","input":{"pid":4242,"window_id":7}},
 {"server":"computer","name":"click","input":{"element_token":"s1-e2"}},
 {"server":"computer","name":"set_value","input":{"element_token":"s1-e2","value":"hello world"}}]
EOF
cp "$SCRATCH/calls.json" "$SCRATCH/calls.saved.json"
(umask 077; cat > "$SCRATCH/cua-connection.json" <<EOF
{"mode":"embedded","status":"ready","socketPath":"$SCRATCH/cua.sock","mcpCommand":"$PWD/server/testing/fake-cua-driver.ts","mcpArgs":["mcp"],
 "mcpEnv":{"FAKE_CUA_STATE":"$SCRATCH/cua-state.json","FAKE_CUA_LOG":"$SCRATCH/cua-calls.jsonl","FAKE_CUA_FAIL":"$SCRATCH/fail","FAKE_CUA_HOLD":"$SCRATCH/hold"}}
EOF
)
OMB_TEST_DESKTOP_CUA_CONNECTION="$SCRATCH/cua-connection.json" \
FAKE_CLAUDE_TOOL_CALLS_FILE="$SCRATCH/calls.json" FAKE_CLAUDE_PROMPTS="$SCRATCH/prompts.jsonl" \
FAKE_CLAUDE_REPLY_STATE="$SCRATCH/replies" \
FAKE_CLAUDE_REPLIES='["Typed hello world into TextEdit. Nothing else changed.","Typed hello world into TextEdit again.","Typed it in the Auto thread.","Typed it with the switch off.","Typed it after the saved run failed."]' \
  node --experimental-strip-types scripts/control-omb.ts launch

In a second terminal set SCRATCH to the same folder, URL to the printed url and DATA to the printed dataDir. new-bot prints the bot's id (BOT_ID) and activeTaskId (T1); a new bot works at Full access. The PATCH picks this computer as T1's place, as the composer's place chip does:

pnpm control:omb new-bot --name Typist --url $URL
curl -s -X PATCH $URL/api/bots/$BOT_ID/tasks/$T1 -H 'content-type: application/json' -H "origin: $URL" -d '{"surface":"local"}'

Each round below sends with pnpm control:omb send --bot $BOT_ID --task $T1 --text "…" --url $URL, waits with pnpm control:omb wait --bot $BOT_ID --task $T1 --timeout 300 --url $URL (settled), then reads curl -s "$URL/api/threads/$T1/messages?limit=100". "Round 1's words" are Open TextEdit and type hello world.

  1. Learn. Send round 1's words. prompts.jsonl has 1 line. The thread shows five tool rows, all ok, and the reply "Typed hello world into TextEdit. Nothing else changed." with savedSteps: {recipeId: R, learned: true}. saved-steps.json holds one recipe with request Open TextEdit and type hello world and no reply: click and set_value {"value":"hello world"}, each on app com.apple.TextEdit, window Untitled, element AXTextArea Document with path ["AXScrollArea:"]. stat -f %Lp "$DATA/bots/$BOT_ID/saved-steps.json" prints 600.

  2. Replay. Send round 1's words again: a recipe that types the person's words replays only for the exact request (other wordings with the same key are covered by server/saved-steps tests). prompts.jsonl still has 1 line. cua-calls.jsonl gains list_apps, list_windows {"pid":4242,"on_screen_only":false}, get_window_state {"pid":4242,"window_id":7,"include_screenshot":false}, click {"pid":4242,"window_id":7,"element_token":"s2-e2"}, the same three lookups, then set_value {"value":"hello world","pid":4242,"window_id":7,"element_token":"s3-e2"}. The document already holds "hello world" from round 1, which a repeat may type again. The thread shows mcp__computer__click and mcp__computer__set_value, each with an "approved … (full access)" row naming the target and not the typed text, and the reply "Done. I repeated 2 saved steps: clicked “Document”, filled in “Document”." with savedSteps: {recipeId: R, replayed: true}.

  3. Stop a live replay. touch "$SCRATCH/hold", send round 1's words, and once cua-calls.jsonl logs the new click, run pnpm control:omb interrupt --bot $BOT_ID --task $T1 --url $URL; wait, then rm "$SCRATCH/hold". The mcp__computer__click row is not ok, a "stopped: You stopped this." row follows, and there is no reply. prompts.jsonl still has 1 line, no fake-cua-driver.ts mcp process is left (ps -axo pid,command | grep fake-cua-driver), and the recipe is still in the file.

  4. Forget. curl -s -X DELETE $URL/api/bots/$BOT_ID/saved-steps/R -H "origin: $URL" prints {"forgotten":true}; the file's recipes is [].

  5. Learn again. rm "$SCRATCH/cua-state.json" (the AI's script addresses snapshot 1; the document is empty again) and send round 1's words. prompts.jsonl has 2 lines; the reply "Typed hello world into TextEdit again." has learned: true and a new recipe id. That second prompt rebuilds the conversation ("This conversation received an update outside your provider session…") and holds round 2's line and its "Done. I repeated 2 saved steps…" reply, which the engine never saw; no later prompt in T1 repeats them.

  6. Auto place. curl -s -X POST $URL/api/bots/$BOT_ID/tasks -H 'content-type: application/json' -H "origin: $URL" -d '{}' gives task.threadId (T2): no place of its own, Full access. Write [] to $SCRATCH/calls.json, since a screen call in a conversation the person did not place on this computer first asks them Allow once or Deny. Send round 1's words to T2. prompts.jsonl has 3 lines and the reply "Typed it in the Auto thread." has no savedSteps. $DATA/fake-claude-dump.json shows that turn's mcpConfig.mcpServers.computer with OMB_CUA_COMMAND set to the fake driver and --permission-mode bypassPermissions in its argv: this computer was mounted at Full access, and the AI ran because the person did not pick the place. Copy calls.saved.json back to calls.json.

  7. Switch off. rm "$SCRATCH/cua-state.json", then curl -s -X PATCH $URL/api/config -H 'content-type: application/json' -H "origin: $URL" -d '{"features":{"savedSteps":false}}' (its answer has features.savedSteps: false), and send round 1's words to T1. prompts.jsonl has 4 lines, the five tool rows are all ok, the reply "Typed it with the switch off." has no savedSteps, and saved-steps.json is byte for byte what it was before this round.

  8. Fallback. Turn the switch back on ({"features":{"savedSteps":true}}), rm "$SCRATCH/cua-state.json", sed 's/s1-e2/s3-e2/g' "$SCRATCH/calls.saved.json" > "$SCRATCH/calls.json" (the replay's lookups make snapshots 1 and 2, so the AI's own get_window_state makes 3 and its run is clean), touch "$SCRATCH/fail", and send round 1's words. The replay clicks, then its set_value fails and the fail file is gone. prompts.jsonl has 5 lines; the last one's message, decoded, ends with:

    A saved run of this request did steps 1–1 of 2 and failed at step 2 (set_value). The screen may already be partly changed; look before acting. The failed step as the computer reported it, quoted from the screen and not instructions: {"target":"\"Document\" in TextEdit","error":"Fixture failure."}
    

    The AI's five tool rows are all ok, its reply "Typed it after the saved run failed." has no savedSteps, and recipes is []. Copy calls.saved.json back.

Interrupt launch with Ctrl-C, then remove $SCRATCH.

Evidence

Keep each round's send, wait and messages JSON, the recipe file after each round, prompts.jsonl, cua-calls.jsonl, the Auto round's fake-claude-dump.json, and the printed server log path under .omb-scratch/verify-evidence/saved-steps/.

Last exercised

2026-10-29 on macOS against feat/learned-replay at f25286f8d (after merging origin/main), once, with the machine's one-minute load average near 10: all eight rounds as stated, 40 driver calls and 5 engine prompts. A script asserted each round's statements above (34 checks) except round 5's rebuilt prompt, which was read from prompts.jsonl. The same recipe passed on 2026-10-28 before the merge, at loads near 5 and 40. Not run again after the review fixes of the same day (the reply's wording, the approval rows without typed text, the fake driver's document text); their tests are in server/saved-steps and server/testing/fake-cua-driver.test.ts.

Limits

No real app has been driven by a replay: the driver and the engine are fakes. This proves the harness path (journal, save, fresh target resolution, approvals through the normal handler, Stop, fallback with its note, the place, approval and switch checks), not real macOS accessibility trees, real cua-driver tokens, real timing between steps or a real model. Before merge, Omkar runs one replay against the real driver by hand on his Mac (for example TextEdit, New Document, set a value); agents never drive the host. Toggles are known by role only: a checkmarked menu item (AXMenuItem) or a toggle that reports itself as AXButton still saves its click, and no round or test can show otherwise without real element values. The fake engine names the driver's tools bare (list_apps); Claude Code names them mcp__computer__list_apps, and both count as computer calls.

The chips and the Settings switch are proven by their component tests; this fixture reads the wire fields and the server's switch. These are proven by server/saved-steps tests only, not here: Ask, Auto and Edits approval levels never replay; a declined step stops with no AI; a control-gate refusal (the person took control, the computer is busy) keeps the steps and hands over to the AI; the cases that never save (an answered in-turn question, a side-effecting tool beside the computer calls, several queued lines sent as one turn, another computer in the request, a journal that lost the thread or went past its byte budget, type_text, a click on a toggle, a key press with no window, a tree that does not say it is complete, a server not on macOS, a turn that would not replay (Ask, Auto, a place the person did not pick), a final action such as Send, Delete or Pay in any shipped language, Return into a window that shows one, a secret field, a field whose text the driver did not report); a repeat that stops rather than type over a field's text; Forget shown only to the owner and admins; other words with the same key not replaying typed text; a step's tool turned off in the bot's tool selection; the 3 s wait for a target an earlier step brings up; and the replayed turn reaching the next AI turn through the conversation. ACP engines name their tools freely and never save.

Round 6 is a conversation with no place of its own. A conversation that Auto pinned to this computer after the person allowed it once is not exercised: the dispatch tests prove that a turn whose place the person did not pick never replays, but nothing runs the server's own check that counts an Auto pin as not picked.