A cockpit for browser and computer-use agents. You watch the live screen, step in while a run is going, and approve before anything is bought.
The agent stops before the last click of a demo checkout and shows the site, what it is about to do and the total.
Operator sits between a headless coding agent (Claude Code, Codex or Antigravity) and the screen it works on. A plain screenshot-and-click loop fails in predictable ways. Clicks land in the wrong place on a high-DPI display. Clicks hit nothing and the agent carries on. An error toast vanishes between two screenshots. Operator is built around those failures.
The cockpit during a research task, with the answer on the left and the page the agent read on the right.
![]() |
![]() |
The launchpad, and the conversation on a phone.
flowchart LR
cockpit["cockpit in the browser"] -- "frames, steering, approvals, stop" --> server["cockpit server"]
server --> db[("sqlite: jobs, approvals, files")]
server --> runner["agent runner"]
runner --> agent["claude code, codex or antigravity"]
agent -- "MCP over stdio" --> mcp["control server"]
mcp --> macro["macros"]
mcp --> perceive["local perception"]
mcp --> overwatch["overwatch"]
macro --> perceive
mcp --> surfaces["surfaces"]
macro --> surfaces
overwatch --> surfaces
surfaces --> chrome["Chrome over CDP"]
surfaces --> sandbox["Linux desktop in Docker"]
surfaces --> real["real desktop, opt-in"]
The cockpit server is a Flask app. It streams the screen to the cockpit, keeps jobs, approvals and files in SQLite, and hands each run to the runner. The runner starts the agent you picked and gives it the control server as an MCP tool. The cockpit page is plain JavaScript with no framework.
Every tool works on a surface, which is one of three screens: the operator's Chrome, a Linux desktop in a Docker container, or the real Windows desktop. A conversation can be open for editing on one device at a time, and another device can take it over.
This repository holds selected modules from a private codebase and is not runnable on its own. The cockpit server and the runner are not part of it.
Clicks land where the agent looked. Chrome returns screenshots in device pixels, but mouse events take CSS pixels. On a display with a pixel ratio above one, a click on screenshot coordinates lands down and to the right of the target. The browser surface reads the page's layout metrics and divides by the scale before every input. Chrome is driven over raw CDP on its own thread, with a timeout on every call. The high-level Playwright helpers can hang forever on a desynced connection, and this way a stuck page fails one call instead of freezing the run (control/surfaces.py):
def _to_css(self, x, y) -> tuple:
"""Frame-pixel coords (what perception saw) → CSS-pixel input coords."""
sx = getattr(self, "_scale_x", 1.0) or 1.0
sy = getattr(self, "_scale_y", 1.0) or 1.0
return (float(x) / sx, float(y) / sy)A click that did nothing says so. On the desktop surfaces, a click, key, scroll or typed text is followed by a local before-and-after comparison of the screen, and the verdict goes into the tool result. If a click changed nothing, the result also carries a zoomed crop around the point, and the text near it when OCR is installed. The agent can re-aim instead of repeating the same click (control/mcp_server.py).
Macros run without the model. The agent sends a list of steps once. Operator runs them, checks conditions between steps from the screen itself, and hands control back the moment something is off: a check fails, a target is missing, a popup appears, or the step or time budget runs out (control/macro.py).
Perception runs locally. Finding things on screen takes no model calls. It is template matching and colour blobs in NumPy and Pillow. Text goes through Tesseract. A map file names the regions of a game's screen, and can lay a grid over a board so that a chess square is clickable as e4. The agent can also ask for a screenshot with numbered marks on the interactive elements and detected targets (vision/).
Overwatch catches what disappears. It records a short burst of frames around an action and returns the frame where the screen changed most, plus the last one. An error toast that shows for 400 ms still gets seen. A rolling recording in 10-second slices, with a log of network requests, console messages and page errors, lets a failure be replayed afterwards.
Stop is checked before every input. The cockpit's stop button writes a file, and each surface reads it before it sends anything. The real desktop is the invasive case. It refuses to start unless the cockpit's per-session confirmation has set OPERATOR_REAL_OK=1.
Approvals ask twice. Purchases, bookings and outgoing messages stop at a card that shows the site, a description and the amount. Approve turns into Confirm before anything is sent, and the decision goes out with the fingerprint of the proposal on screen. The server refuses a decision if the proposal has changed or is no longer pending, and a revised proposal replaces the pending one. An approval nobody answers expires after 15 minutes. Request changes sends a note back to the agent instead of a yes or no (static/js/workbench.js).
Loops get a nudge. The runner notices when the same action repeats, when clicks keep landing within a few pixels of each other, and when the agent keeps acting without looking at the screen again. It does not kill the run. It adds a nudge to the agent's next turn.
A silent run gets stopped. After two minutes with no new output, step or state change, a run is marked as stalled. After five it is stopped as if you had pressed Stop. The limits are generous because a long reasoning step is quiet but still working.
Done is checked. If a run did something with consequences and finished without a last look at the screen, it is sent back once to check before the answer is accepted. An answer given with no browser action on a task that needed one is thrown away, not shown as done.
Corrections reach a running agent. A message you send while it works goes into the current turn where the runtime supports that, and at the next boundary otherwise. If it has not arrived after three seconds, the run is interrupted and resumed with the correction. Manual mode hands you the screen, and Auto mode lets the agent steer.
The live view is paced by bandwidth. The feed waits before asking for the next frame, for longer when the last one was large. The browser and the server will not agree on the time, so it keeps a lower and an upper bound on how old a frame was when it painted, instead of claiming an exact figure (static/js/operator_feed.js).
The sandbox is isolated. It is an Ubuntu desktop with XFCE in a Docker container, with its own filesystem, network and process namespaces and a non-root user. The container is kept until it is deleted on purpose.
| File | What it does |
|---|---|
control/mcp_server.py |
The server the agent talks to. Tools: perceive, game_macro, computer, overwatch, emu_input, sandbox_exec and sandbox_window |
control/surfaces.py |
One interface over the browser, the sandbox and the real desktop, with the stop check |
control/macro.py |
Runs a list of steps locally and checks conditions between them |
control/emu_input.py |
Controller buttons and checkpoint slots for a game running in the sandbox browser |
vision/perceive.py |
Template matching, colour blobs and OCR |
vision/maps.py |
Loads per-game map files into finder specs, scaled to the frame |
vision/overlay.py |
Coordinate grids, crops and numbered marks drawn on a screenshot |
static/js/workbench.js |
Approval cards, results and conversation files in the cockpit |
static/js/operator_feed.js |
Frame pacing and latency bounds for the live view |
static/js/operator_pickers.js |
The menus for model, effort and speed |
The source is proprietary. This repository shows selected modules for reading; no license is granted to use, copy, modify or distribute them. Issues and pull requests are not accepted.



