# SuperSelector Studio for Codex Computer Use

SuperSelector Studio gives computer-use agents durable targets and cacheable action sequences for arbitrary macOS interfaces.
## Architecture notes
- [Sky / Codex Computer Use on macOS](https://docs.monadical.com/s/codex-sky-deep-dive) explains the native architecture, capture/action lifecycle, accessibility model, and design lineage.
- [Stagehand v4 and Sky / Codex Computer Use](https://docs.monadical.com/s/stagehand-v4-sky-control-plane) compares their agent loops, element resolution, event systems, replay, tracing, and recovery.
- [SuperSelectors: Durable UI Addressing Between Observation and Replay](https://docs.monadical.com/s/superselectors-durable-ui-addressing) synthesizes those lessons into the durable-target design and maps its remaining hard problems.
A Computer Use element index is an excellent address inside one captured UI tree. It is not an identity that can safely survive another capture, a window rearrangement, an application restart, or a different machine. A SuperSelector preserves provider-attributed evidence about a target so the corresponding element can be found again.
The result is a two-speed execution model:
1. Codex Computer Use observes and reasons when a workflow is unfamiliar or the UI has changed.
2. SuperSelector Studio records durable targets and actions while keeping their screenshots and agent-facing trees together.
3. A recording can run as a deterministic fast path without another model decision between every action.
4. Target ambiguity stops cached execution; the integration contract returns that cache miss to the ordinary Computer Use loop.
> **Download the latest [`SuperSelector.app`](https://github.com/pirate/cua-superselector/releases).**
## The data model
SuperSelector uses separate types for evidence with different lifetimes. Snapshot-local addresses never leak into durable identity.
| Concept | Swift type | Lifetime | Purpose |
| --- | --- | --- | --- |
| Skyshot | `ComputerUseSkyshot` | One observation | Combines capture context, provider evidence, durable target, and agent tree |
| Capture context | `ComputerUseCaptureContext` | One observation | Timestamp, pointer, display, trust state, and target AX snapshot |
| AX node | `AccessibilityNode` | One tree revision | Agent-visible role, name, state, actions, frame, and element index |
| Agent tree | `UIElementRenderTree` | One tree revision | Indexed hierarchy rendered in `AppState.text`-compatible form |
| Durable evidence | `DurableTargetHint` | Shareable | Provider-attributed semantic, structural, content, state, and geometry evidence |
| Provider state | `CaptureProviderReport` | One observation | Whether an evidence source is available, degraded, or unavailable |
| Workflow library | `ComputerUseWorkflowLibrary` | Persistent | Versioned collection of recordings and screenshot assets |
| Workflow recording | `ComputerUseWorkflowRecording` | Persistent/shareable | Ordered steps, final target, provenance, and Computer Use contract |
| Workflow step | `ComputerUseWorkflowStep` | Persistent/shareable | Target, action, screenshot geometry, and captured agent tree |
| Recorded action | `ComputerUseRecordedAction` | Persistent/shareable | Click, scroll, text, key, or hover input data |
| Replay plan | `ComputerUseReplayPlan` | One execution | Full reset replay or a cached action subsequence |
```mermaid
flowchart LR
CU["Codex Computer Use"] -->|observe and choose| S["ComputerUseSkyshot"]
S --> T["UIElementRenderTree"]
S --> H["DurableTargetHint set"]
T --> I["revision-local element index"]
H --> D["ss3/e1 durable target"]
D --> W["ComputerUseWorkflowRecording"]
W --> P["ComputerUseReplayPlan"]
P --> R["fresh resolve → verify → act"]
R -->|verified| R
R -->|cache miss| CU
```
### Skyshots and agent trees
A `ComputerUseSkyshot` represents one observation of the desktop. It contains:
- the `ComputerUseCaptureContext`;
- one `CaptureProviderReport` per evidence source;
- the complete set of `DurableTargetHint` values;
- the encoded `ss3/e1` target;
- a bounded `UIElementRenderTree`; and
- the target node highlighted within that tree revision.
The render tree assigns a temporary `elementIndex` to each `AccessibilityNode`. Studio renders it using the same basic grammar agents receive in `AppState.text`: an application/window header, indexed and indented roles, names and values, disabled or selected state, secondary actions, and the focused-element summary.
```text
Window: "Preferences", App: Example.
0 group Settings
1 text field Search
2 group General
3 checkbox Launch at Login (selected)
4 button Save
The focused UI element is 1 text field Search
```
The index `4` is meaningful only for that exact tree revision. A recording stores the target's SuperSelector, not `4`.
Studio derives this compatible rendering from the application's macOS Accessibility hierarchy. An external Computer Use bridge can ingest the authoritative `AppState.text` and screenshot seen by Codex; private Sky service IPC is not part of the persistence format.
### Durable target evidence
A SuperSelector can combine evidence from every layer available to the driver:
- screen and display geometry;
- macOS Accessibility roles, labels, identifiers, values, actions, and ancestry;
- OCR text and bounds;
- visual landmarks or image features;
- browser viewport and document geometry;
- CSS, XPath, DOM, and browser accessibility properties; and
- framework- or application-specific identifiers.
One target may produce evidence like:
```text
[screen.absolute] pointer.position.screen = 1432.0,811.0
[screen.absolute] element.frame.screen = x=1391.0,y=790.0,w=92.0,h=32.0
[mac.ax] application.bundle-id = com.apple.Safari
[mac.ax] semantic.role = button
[mac.ax] semantic.name = Continue
[mac.ax] capability.action = invoke {native=AXPress}
[mac.ax] ancestor.role-path = application>window>group
[browser.viewport] element.frame = x=804,y=612,w=92,h=32
[browser.css] selector = button[data-action="continue"]
[ocr] text = Continue {confidence=0.99}
```
Every evidence field names its provider, category, kind, value type, metadata, quality, and privacy classification. Providers remain independent: a native app might expose only screen and AX evidence, while a browser can add DOM and viewport evidence and a remote desktop might supply only image, OCR, and coordinates.
The compact representation is lossless:
```text
ss3/e1~pscreen.absolute|bgeometry|kpointer.position.screen|tn|v1432.0%2C811.0|morigin=top-left;space=quartz-global|q1.000000|rpublic~...
```
`ss3/e1` identifies the selector and encoding version. Each following field independently preserves:
- provider and evidence band;
- evidence kind;
- scalar (`tn`) or text (`ts`) value type;
- escaped value and sorted metadata;
- provider-reported quality; and
- privacy classification.
Runtime handles are excluded from durable identity. AX object references, process IDs, Windows HWNDs and UIA RuntimeIds, CDP node IDs, and Computer Use element indexes belong only to live resolution state.
## Capture providers
Capture providers describe the same target from different layers.
| Provider | Layer | Example evidence | Availability |
| --- | --- | --- | --- |
| `screen.absolute` | Display server | Pointer, display ID, target frame, normalized geometry | Implemented |
| `mac.ax` | macOS Accessibility | App/window identity, roles, labels, values, actions, state, ancestry | Implemented |
| `windows.uia` | Windows UI Automation | Control type, AutomationId, name, patterns, bounding rectangle | Planned |
| `ocr` | Screenshot | Text spans, language, confidence, bounding polygons | Planned |
| `visual` | Screenshot | Icons, region features, edges, color, nearby landmarks | Planned |
| `browser.viewport` | Browser view | Viewport coordinates and visible bounds | Planned |
| `browser.document` | Browser document | Document coordinates, scrolling, frame ancestry | Planned |
| `browser.css` | DOM | Tag, attributes, classes, selector candidates | Planned |
| `browser.xpath` | DOM | Structural paths and nearby context | Planned |
| `browser.ax` | Browser Accessibility | Roles, names, properties, and relationships | Planned |
| `electron.*` | Application runtime | Renderer and application-specific identity | Planned |
Providers implement `ComputerUseCaptureProvider`:
```swift
protocol ComputerUseCaptureProvider {
var id: String { get }
func report(for scene: ComputerUseCaptureContext) -> CaptureProviderReport
func hints(for scene: ComputerUseCaptureContext) -> [DurableTargetHint]
}
```
Provider IDs and evidence kinds are open strings. Unknown providers and fields survive encoding even when a particular resolver cannot interpret them.
## SuperSelector Studio
`SuperSelector.app` is a live macOS recorder, inspector, and replay debugger for Computer Use workflows.
As the pointer moves, the app:
- captures a `ComputerUseSkyshot` for the target under the pointer;
- outlines the target and draws display-relative crosshairs and rulers;
- displays the screenshot and `UIElementRenderTree` side by side;
- uses one `SuperSelectorBoxModel` for the live outline, screenshot annotation, tree highlight, and replay coordinates;
- shows provider availability and every durable evidence field;
- records clicks, scrolling, text, keys, and semantic target transitions as `ComputerUseWorkflowStep` values;
- keeps the 15 most recent exact selectors in newest-first order;
- copies a selector sampled at the exact click location; and
- resolves a pasted `ss3/e1` target for visual inspection without acting on it.
The overlay and status item are excluded from clean screenshots. The overlay also hides while its own menu is active so it does not become part of the target application state.
Open **SuperSelector Studio…** from the menu bar or press **Command-Shift-I**.
### Recording workspace
The three-column workspace keeps the workflow library, ordered actions, and selected-step evidence visible together. A selected step contains:
- its durable `ss3/e1` target;
- readable semantic target path;
- `ComputerUseRecordedAction` payload;
- clean screenshot asset;
- screen, window, target, and pointer geometry;
- bounded agent-tree text; and
- capture and action timestamps.
Start a recording. Interact with another application while Studio captures targets, actions, trees, and screenshots. |
Inspect a step. The screenshot box and tree index identify the same target in the same Skyshot. |
Inspect live evidence. Provider provenance, agent tree, target identity, state, actions, and geometry remain visible together. |
Execute deterministically. Run from a normalized desktop, replay through a selected step, or execute a cached action range against the current UI. |