# Blind-fill Vault and automation

Prompt instructions like *"never leak passwords or exfiltrate user data"* fail as soon as an agent reads an untrusted web page or a compromised tool schema. Sikemux enforces credential isolation, egress taint, and tool-schema integrity inside `sikemux-core`, outside every model's context window, while giving agents full native automation over WebKit tabs, desktop apps, and mobile simulators.

## Blind-fill Vault (`vault_list`, `vault_request`, `vault_fill`)

Secrets, payment cards, contact profiles, and sensitive documents live encrypted on your host under **Settings → Vault** (or linked from 1Password via `op://` references; see [Secrets from 1Password](/agents/secrets/)). Four categories are supported: `details`, `secrets`, `payments`, and `documents` (files up to **25 MB**).

Agents never receive raw secret values. They interact exclusively through opaque references (`vault:<id>` or `vault:<id>.<field>`):

```text
Agent context (zero plaintext)              sikemux-core (host)              Target page / OS
------------------------------              -------------------              ----------------
1. vault_list() --------------------------> returns IDs, titles, field keys,
                                            domain hints (never values)

2. (if missing) vault_request(...) -------> opens native host card ("Sealed on this host")
                                            person types secret / attaches file
   <--------------------------------------- returns vault:<id> only

3. vault_fill(ref: "vault:<id>.password") -> checks domain allowlist + Touch ID approval
                                            resolves plaintext / TOTP code inside host
                                            --------------------------------> real OS input
   <--------------------------------------- returns { ok: true } (never value)
```

Key guarantees of the Vault pipeline:

- **Discovery without disclosure:** `vault_list` returns entry IDs, titles, categories, field names, and domain hints, never field contents.
- **Host-rendered intake (`vault_request`):** When an entry does not exist yet, `vault_request` opens a native card directly in the chat (blocking up to `waitMs`, default **50,000 ms**, max **55,000 ms**; `waitMs: 0` returns `status: "pending"` without cancelling). Agents may prefill non-sensitive metadata (`email`, `username`, `url`, `document_number`) or suggest a host `filePath` for a document; prefill is rejected outright for `payments` and sensitive fields.
- **Direct reference injection:** Pass `vault:<id>.<field>` to `vault_fill`, `browser_type`, `browser_drive` (`tab.fill` / `tab.type`), or `desktop_drive`. Pass bare `vault:<id>` to `browser_upload` / `tab.upload` to blind-upload an encrypted document, or to `vault_fill` / `browser_dialog` to answer an HTTP Basic or Digest auth challenge against the challenge's host.
- **On-host 2FA and approval gates:** TOTP 2FA codes are generated inside the host at fill time. Payment cards (whose CVC is never persisted) and first-time domain secrets require explicit Touch ID or host approval before injection.
- **Cross-origin iframe protection:** Agents cannot inspect DOM fields inside cross-origin frames (such as embedded payment widgets or third-party login iframes), though they can focus and blind-fill at the caret.

## Lethal-Trifecta egress taint and Write-Promotion Gate

Prompt injection becomes dangerous when three capabilities intersect in a single session (the **Lethal Trifecta**):

1. **Private data access** (`read_private`)
2. **Untrusted external input** (`read_untrusted`)
3. **External egress** (navigating to an arbitrary external origin or invoking a mutating external connector)

`sikemux-core` maintains a per-session `TaintRegistry` (tracking up to **16 taint sources** per agent) directly in the harness layer:

| Taint flag | What sets it | What does **not** set it |
| --- | --- | --- |
| **`read_private`** | Reading `space:personal/*` or other sensitive personal records | `vault_list`, `vault_fill`, `vault_request`, and `memory_list` are **exempt** because no secret plaintext enters context |
| **`read_untrusted`** | `browser_state`, `browser_find`, `browser_evaluate`, `browser_network`, `browser_console`, `browser_screenshot`, `browser_drive`, and `plugins.call` | Local repository files and core-signed local state |

### Runtime enforcement when both flags hold

As soon as a session has both `read_private` and `read_untrusted` set:

- **External navigation is restricted:** `browser_navigate` is blocked for any origin not already in the session's `allowed_origins` list (origins visited cleanly *before* the session touched untrusted content). Loopback hosts (`localhost`, `127.0.0.1`, `::1`) remain exempt so local development keeps working.
- **Mutating plugin calls are blocked:** Any non-read-only connector call (`plugins.call` where `!is_read_only_tool`) is blocked from leaving the host.
- **Explicit human reset:** Blocked egress pauses until the person approves an explicit `ask`, which clears the session taint.

### Write-Promotion Gate

Before an agent promotes data into shared `project` or `org` Space, the kernel runs a two-stage Write-Promotion Gate:

1. **Secret scan:** Payloads that trip deterministic secret detection are rejected immediately.
2. **Private-to-shared hold:** If the writing session has `read_private` set, promotion into shared Space pauses for human review before committing.

## Remote MCP manifest SHA-256 pinning

Remote MCP servers can silently mutate tool descriptions after installation to inject hidden instructions ("rug pulls"). Sikemux prevents silent schema drift in `sikemux-host`:

- On approval, the host hashes every remote tool's schema into a per-tool `schema_hash` and computes a whole-server `pinned_manifest_hash` (SHA-256).
- Before executing calls against a remote MCP server, the host compares the live tool list against the pinned manifest.
- If any tool is added, removed, or modified, `diff_tool_manifest` generates an exact structural diff and halts execution until you review and approve the new manifest.

## Parallel WebKit automation (`browser_drive`)

Individual `browser_*` tools handle single clicks, waits, and inspections (see [How agents use pages](/browser/agents-and-pages/) and [WebKit](/browser/webkit/)). For multi-step flows, branching, loops, or parallel multi-tab work, agents use **`browser_drive`**, a sandboxed async JavaScript runtime on the host (`script` up to **40,000 characters**; `timeoutMs` default **45,000 ms**, max **115,000 ms**).

For work that spans Sikemux's own tools, such as reading the board, starting workers and checking a process in one go, agents use **`sikemux_drive`**: the same sandboxed JavaScript, with Sikemux's tools as its SDK, up to 200 steps per script.

Every SDK call routes through Sikemux's real OS input primitives on the agent's live WebKit desk tabs without stealing your focus or keyboard, and returns only the compact JSON object your script returns.

### `browser_drive` host SDK

| Entrypoint / handle | Methods |
| --- | --- |
| **`browser`** | `browser.tabs()`, `browser.open(url, { background? })`, `browser.tab(id?)`, `sleep(ms)`, `URL`, `URLSearchParams`, `setTimeout` / `clearTimeout` |
| **`Tab`** | `goto`, `click`, `hover`, `type`, `fill`, `select`, `press`, `scroll`, `wait`, `state`, `find`, `eval`, `upload`, `dialog`, `download`, `screenshot`, `console`, `network`, `viewport`, `close` |

```js
// Open two docs pages in the background, read them in parallel, return compact JSON
const [a, b] = await Promise.all([
  browser.open("http://localhost:4321/agents/agent-kernel/", { background: true }),
  browser.open("http://localhost:4321/llms.txt", { background: true }),
]);

const [heading, llms] = await Promise.all([
  a.eval(() => document.querySelector("h1")?.textContent?.trim()),
  b.eval(() => document.body.innerText.split("\n").length),
]);

await Promise.all([a.close(), b.close()]);
return { heading, llmsLines: llms };
```

- **Target flexibility:** `tab.click`, `tab.type`, `tab.fill`, and `tab.select` accept element index numbers, visible text/labels, CSS selectors, or options objects (`{ field, selector, index, optional }`).
- **Vault integration inside scripts:** `tab.fill(target, "vault:<id>.<field>")`, `tab.upload(target, ["vault:<id>"])`, and `tab.dialog("accept", "vault:<id>")` resolve strictly inside the host.
- **Authenticated downloads:** `tab.download(url, { filename? })` performs a read-only `GET` using the tab's signed-in WebKit session and saves the file into Sikemux's downloads folder, returning `{ path, mimeType, bytes }`.
- **Native desktop apps:** Beyond the browser, `desktop_drive` drives macOS, Windows, and Linux apps via the `sikemux-desktop` accessibility helper, with incremental accessibility-tree diffs, background clicks, Vault blind-fill, and instant abort on `Escape`.

## Live mobile simulator automation (`sim`)

Agents build, install, inspect, and drive **iOS Simulators** (via the `sikemux-sim` Swift helper on macOS) and **Android emulators** (`platform: "android"`) directly on their desk using the `sim` tool, never launching `Simulator.app` over your screen or colliding over `adb`.

### Exclusive device ownership and lifecycle

- **One agent per device:** `sim devices` reports `inUseBy` for every simulator. Calling `sim attach` claims an available device and streams it live onto the agent's desk where you can watch and tap alongside it.
- **Queueing and leases:** Cold boots and full-host waits hold an agent's place in line as long as it polls within **60 seconds** (up to 5 minutes before asking you). Inside a turn, a device idle for **10 minutes** yields to waiting agents; once nobody holds a Sikemux-booted device, it shuts down after a **3-minute** grace period while keeping installed apps and data intact.

### All 18 `sim` actions

| Category | Actions | Details |
| --- | --- | --- |
| **Lifecycle & apps** | `devices`, `attach`, `detach`, `install`, `uninstall`, `launch`, `terminate`, `open_url` | `launch` automatically cold-relaunches (iOS) or force-stops and relaunches (Android); `open_url` handles deep links and Expo dev-client URLs |
| **Inspection** | `state`, `screenshot`, `logs` | `state` returns the frontmost app plus up to **200 numbered elements** with center points (points on iOS, dp on Android); `logs` streams cursor-paged output filtered by `process`, `level` (`verbose`–`error`), `tag`, `search`, and `exclude` |
| **Input & gestures** | `tap`, `type`, `swipe`, `button`, `rotate`, `touch_path`, `touch2_path` | `tap` targets `index` or `label` (auto-dismissing iPad popovers when covered); `swipe` inside content scrolls while within 10 pt of an edge triggers system gestures; `touch2_path` drives two-finger gestures (`x1`, `y1`, `x2`, `y2`) |

### Typical mobile build-and-test loop

- **iOS:** Build with `xcodebuild -sdk iphonesimulator -derivedDataPath <inside-project>` via `process_start`, install the `.app` with `sim install`, launch by bundle ID with `sim launch`, inspect via `sim state` (not screenshots) before tapping, and read `Logger`/`os_log`/`NSLog` (`.info` or higher) via `sim logs`.
- **Android:** Build with `./gradlew assembleDebug` via `process_start`, attach with `platform: "android"`, install the `.apk` with `sim install`, launch by package name with `sim launch`, and use `sim button` for hardware actions like `back`.
- **Expo / React Native:** Start only the Metro bundler (`expo start --dev-client` or `react-native start`, without `--ios`/`--android`) and open `<scheme>://expo-development-client/?url=http%3A%2F%2F127.0.0.1%3A8081` with `sim open_url`.

- [How agents use pages](/browser/agents-and-pages): Desk tabs, HTML/Markdown artifacts, mockup pins, and encrypted artifact sharing.
- [Secrets from 1Password](/agents/secrets): Link provider keys, tokens, and Vault credentials with op:// references.
