# Ghostlight 1.0 model-facing language ## Contract rules The 23 tools below are the complete 1.0 catalog. Input objects and nested objects set `additionalProperties` to `false`. Every input schema is a top-level object without root-level `oneOf`, `allOf`, or `anyOf`, because current Kiro and Bedrock reject those otherwise valid JSON Schema forms. Conditional inputs advertise one portable teaching envelope; the typed decoder enforces the exact branch before governance or browser dispatch. Omitted optional fields use the defaults stated here. A field that several branches share is advertised as one schema that admits every value any branch admits. Constants join one `enum`, length and numeric bounds widen, and each value of a discriminator such as `action` or `condition` keeps its own description. `anyOf` appears only inside a field whose alternatives are different JSON types, and no field uses `oneOf`. A strict JSON Schema validator therefore accepts every ordinary call. Tests validate every example and a list of ordinary calls against the advertised schemas, decode them, and check that every next step naming a tool names only fields that tool advertises (ADR-0196). Each declaration includes field guidance, one shortest valid example, and standard MCP annotations. `docs/1.0/catalog.json` is the exact catalog, pinned by a test. The catalog says only what a field's name, type, enum, bounds and default do not. Guidance every tool shares, the optional `tab` and the `timeout_ms` bound, is in the server instructions and in a short `tab` description; `timeout_ms` and `visual_settle` carry none. The coordinate fact lives once in each `view` description: `x` and `y` are pixels in the view's screenshot image, not CSS pixels. The governance phrases stay and are pinned by a test: "for this request", "admitted before the effect", "may cause an external effect", "needs write even for unsent drafts", and "screenshot image". The serialized `tools` array that `tools/list` returns has a size budget (31,800 characters, with caps on the five largest tools) that only ratchets down: a later change raises it by the measured size of a clause its new behavior needs. The implementation owns bounds and defaults as named constants shared by schema rendering and decoding. A field sent with its advertised default means the same as leaving it out, because some clients fill in every default before they send a call; a self-check sends every example and known-good call with its defaults filled in. See [ADR-0198](../adr/0198-agent-experience.md). The schema shows each field's canonical form; the decoder reads more (ADR-0205). Values read the way CSS reads a declaration: a duration as `2000`, `"2000ms"` or `"2s"`; a count or a length as a number, digits, `"125%"` or `"120px"`; a boolean as `true` or `"true"`; a closed word in any case, with `left` and `right` for the primary and secondary button; a key in any case or by its common name, a chord such as `"ctrl+a"` as the key with its modifiers, and a space-separated sequence as strokes; an address without a scheme with `https://`, or `http://` for loopback hosts. Field names are read in snake, camel or kebab case. A limit on what a call reads, and `timeout_ms`, are brought inside their bounds instead of refused. A value a call leaves out comes from the call or the page where one reading is sensible: an action word from its fields (`{}` lists tabs or reports a dialog), a wait's condition from what it waits on, a scroll's direction from the page. A field the chosen action does not use is ignored, and an unknown field on a tool that only observes is ignored too. The result names what Ghostlight left out in an `ignored` fact and what it used instead of what was sent in an `adjusted` fact, each only when it has content. Strict as before: authority (policy, Pause and Stop, and `user_authorized_credentials`, which takes only `true`), content (typed text, form values, scripts, paths), two readings with different effects, counts of actions beyond their bounds, an unknown field on a tool that acts (refused with the closest field and the tool's fields), and a value with no reading. `browser_flow` is the single composition tool for one to twenty ordinary tool calls. Step IDs are optional for short batches and available for explicit result references. Each child uses the invocation's immutable configured authority snapshot and the ordinary executor. `on_error` defaults to `stop`. Captured result payloads have a bounded total budget; progress remains explicit. Authority comes from configured managed/local policy and human controls. Tools do not accept `restrict_hosts`, `restrict_capabilities`, or `browser_flow.dry_run`. The retired `browser_sequence` tool is replaced by ordinary tool steps in `browser_flow`. The retired `browser_workspace` tool is gone because a session works only in its own workspace. Obsolete calls fail before browser work with catalog-refresh guidance; nothing retries automatically. See [ADR-0162](../adr/0162-configured-authority-and-one-flow-tool.md) and [ADR-0196](../adr/0196-simple-pipeline-and-contained-boundaries.md). An optional `tab` selects an opaque controlled tab. Omission selects the session's only controlled tab. Otherwise the call is rejected before any browser work, and the refusal says which case it hit. Several agents that share one client connection share its session, so with several tabs no tab is a default, and the refusal lists them in `tabs`, each with its `tab`, `title` and `url`. `browser_tabs` list needs no tab, a target or view handle names its own tab, and in a `browser_flow` that names no tab, a step that opens a tab makes it the tab of the later steps (ADR-0198, amendment of 2026-10-18): | Case | Summary | `reason` | Next step | | --- | --- | --- | --- | | No tab yet | `This session has no open tab yet.` | `no_tab` | `browser_navigate` with `url` | | Several tabs could be meant | `More than one tab is open in this session, so the call must name one.` | `ambiguous_tab` | repeat with `tab` from `tabs` | | Named tab is gone | `That tab handle names no open tab in this session.` | `tab_unavailable` | `browser_tabs` list | `tab_unavailable` is true for a handle whose tab closed, whose binding the browser did not confirm, and a handle the session never issued. After a browser restart a remembered tab is confirmed by its id and the page it last showed before it is used, and one the browser does not confirm reads this way (ADR-0203 Decision 1). An update keeps a session's tabs, and the session resumes with them. A person's Quit, an uninstall, or an end for a reason the service does not know releases them, so the resumed session's earlier handles read this way and the agent opens a fresh tab (ADR-0203 Decision 3). Each session works only in its own workspace. A tab, target, or view handle that belongs to another session is refused before any browser work with `reason: ownership_mismatch`. When the owning session's opener is an agent Ghostlight can name, the summary names it the way the window does, for example `That handle belongs to another Ghostlight session (Claude Code).`, the `owner_workspace` fact carries the same name, and the next step is `browser_tabs` list in the caller's own session. For an opener nothing names, the summary is `That handle belongs to a different Ghostlight session.` and the next step is to collect fresh handles in this session. The audit keeps neither name. A refusal never carries another session's workspace id. No tool lists other sessions or moves a session into another workspace (ADR-0196 Decision 8). A handle that belongs to this session but does not fit the call is refused before any browser work with `failed`, no effect and `repeat_safe: true`, and says what is true of it (ADR-0203 Decision 5.3). The audit keeps the bare cause word under `workspace_unusable` and never the other tab's handle: | Case | Summary | `reason` | Next step | | --- | --- | --- | --- | | A target or view handle of another of this session's tabs than the one the call named | `That handle belongs to tab_..., another of this session's tabs.`, with that tab in `handle_tab` | `handle_on_other_tab` | repeat with handles from one tab, and `tab` left out or set to that tab | | A fill whose fields or submit target sit on more than one tab | `A fill works in one tab, and these targets are on more than one.` | `fields_on_several_tabs` | one `browser_fill_form` call for each tab | | A point outside the view's image | `Those coordinates are outside the view's image, which is W by H pixels.`, with the size in `image` | `outside_image` | repeat inside the image, or take a new `browser_screenshot` | A tab that a refused landing left on the refused page is held. It still refuses reading and acting: such a call is `blocked`, no effect, `reason: tab_held`, with the `denial_id` and `policy_rule` of the landing that held it, and its summary names the refused host, for example `That tab shows example.com, which this session may not use, so Ghostlight will not read or act on it there.`. The one next step names the calls that clear it: `browser_navigate` with the tab and an allowed `url`, or `browser_tabs` with action `close`. Each is authorized on its own, never on the page the tab shows, and a governed landing clears the hold. A held tab is not paused, so nothing asks the person to resume, and a `browser_flow` step on a held tab is blocked by policy: the flow follows its `on_error` choice, as for any policy refusal, where a pause would stop it. The audit records the landing's denial, reason, rule, denial id and tier, with the cause `tab_held`; under a republished authority the refused address is decided again and that decision is recorded (ADR-0203 Decision 5.5). Tab handles are durable correlation slots: navigating by a handle whose tab has closed recreates that tab through the governed open path under the same handle and says so in the summary. Closing a handle this session no longer holds sends nothing to the browser and says only that: "This session no longer holds that tab, so nothing was closed.", with the step to list this session's tabs. Its tab may have closed, or a service before this one held it and it may still be open, so the answer claims nothing about the tab (W-D4). Target handles are different by design -- they are perception, not identity. A target handle is tied to one tab and document generation, and a committed navigation makes prior target handles stale. Within one document a handle follows its control through a re-render when the page proves it is the same control: its row's own link, unique on the page, its declared row name, its role, exact name and position in the row, and an unchanged view. The action then reports `rebound: true` in its facts and says its usual sentence; the audit keeps the bool and never a handle, row or link. Anything short of proof refuses as removed. Reading the same control again in the same document returns the same handle, also after a re-render the page proves. A stale target handle refuses with `reason: stale_target`, no effect and `repeat_safe: true`, and a `stale` fact that says why in one of four words, whoever noticed. The service notices a closed tab or a left document; the page notices a control that left it. A handle of a closed tab, of a document the tab left, or of a control the page reported removed refuses at once, before anything is sent to the browser. A handle of a control in an embedded document that was replaced or removed is `navigated` too, as is the one target handle of a call that met a changed document, instead of an unverified page (ADR-0203 Decision 5.4). The sentence and the step depend on the word only, and never quote page text: | `stale` | Summary | Next step | | --- | --- | --- | | `removed` | `That target is no longer on the page.` | `browser_find` or `browser_inspect` | | `navigated` | `That target belongs to an older version of the page.` | `browser_inspect` | | `tab_closed` | `That target's tab is closed.` | `browser_tabs` | | `unknown` | `Ghostlight does not know that target handle.` | `browser_find` or `browser_inspect` | Candidates the live page still has are listed in `recovery_candidates` only when the tab's address is readable under the session's authority. Each carries a fresh handle (`target`), its `role`, its `nth` among controls that share its row, and, only when the session preserves target names, its `name` and its row `context`. For a control the page found removed, the candidates are the page's own lookup in the failing call: up to three controls with the same role, exact name and credential class, in that document. For a left document they come from a separate unpainted query, and the step stays `browser_inspect`. The refusal names one control as `replacement`, and its step is `Repeat with target .`, only when all of these hold: the word is `removed`; nothing was sent; the tool takes exactly one target (`browser_click`, `browser_hover`, `browser_type_text`, `browser_press_key` and `browser_scroll` with a target, `browser_upload`, `browser_wait` with a target; never `browser_fill_form` fields or `browser_drag`); the page found exactly one control that matches role, exact name, credential class and row, and the row's own link when the row had one, in an unchanged view; and the lookup was not cut short. The summary then adds `One control on the page has the same role, name and row.` Otherwise, with candidates, the step is `Pick a target from recovery_candidates by its context, or call browser_find for current target handles.` The candidates are listed in the order of their `nth`, those with none last. When `privacy.preserve_target_names` is false a candidate carries only `target`, `role` and `nth`, so the step says `by its role and nth` in place of `by its context`. The audit and the history keep the stale word only: never a replacement, a handle, a row or a candidate. A handle the service never issued, dropped to bound memory, or whose control the page no longer holds in its registry is `unknown`. A control the page still holds under a handle but which now sits in a different row, because its list recycled the node, is also `removed`. A control the page refuses before acting on it refuses with `reason` set to the page's code, no effect and `repeat_safe: true`. The summary says what was refused, then that nothing happened in the call's own gesture (`Nothing was clicked.`, `Nothing was typed.`, `No field was filled.` and so on); a flow step says its own. It never quotes the page's message. The audit keeps `{"reason":"page_refused","cause":""}` (ADR-0198, amendment of 2026-10-18): | `reason` | Summary (a click or typing) | Next step | | --- | --- | --- | | `not_visible` | `That target is not visible on the page. Nothing was clicked.` | `browser_find` or `browser_inspect` for a visible control | | `disabled` | `That target is disabled. Nothing was clicked.` | `browser_inspect`, then repeat once the page enables it | | `read_only` | `That field is read-only. Nothing was typed.` | `browser_find` with scope control | | `not_editable` | `That target does not take typed text. Nothing was typed.` | `browser_find` with scope control | A same-document change is not a committed navigation. When an action moves the address within the same origin and no document commits, as an anchor link or a `history.pushState` route does, the generation and target handles stay valid. The tab's governed URL follows the page, landing governance still checks the new address, the action's `landing` fact carries the new `url` with the unchanged `document_generation`, and view handles expire because the rendered page may have moved. An address in another origin always starts a new generation. An explicit `browser_navigate` or `browser_history` call always starts one too. Typed semantic selectors (name, optional role, optional exact match) are accepted in place of a target handle by `browser_click`, `browser_type_text`, `browser_upload`, each `browser_fill_form` field, and the `selector_present` wait, so drivers can prefer what a control is called over stashing handles. Every other call that takes a target takes a handle. A selector's `role` is one of `button`, `link`, `checkbox`, `radio`, `textbox`, `searchbox`, `combobox`, `listbox`, `slider`, `spinbutton`, `tab`, `menuitem` or `option`; each is a role an observed control can have. A selector that matches no visible control, or more than one, acts on nothing and says so: `No visible control matched the semantic selector in the inspected content.`, or `3 visible controls matched the semantic selector; none was chosen.` Ghostlight asks the page for at most 8 matches, and when more matched than that the sentence starts `At least 8`. View handles are returned by screenshots. They bind rendered coordinates to one tab, document generation, viewport origin, viewport size, device scale, and zoom. Coordinate input is rejected when that binding is no longer current. Coordinates use the returned image dimensions, with the top-left pixel at `(0, 0)`. A bounded region screenshot returns a new view with its own transform, so another region can be selected from the magnified image. Every tool accepts `timeout_ms`, bounded from 100 to 30000 milliseconds. It defaults to 8000 milliseconds, except that `browser_fill_form` and `browser_record` default to 30000. Text is UTF-8 and bounded. URLs must be absolute `http` or `https` URLs. Handles are short. Ghostlight issues `tab_`, `target_`, `view_`, `snapshot_` and `image_` handles as the prefix and eight random base32 characters (`tab_k3m9x2ab`), 12 to 17 characters in all where the same handles were 36 to 41. A handle is still checked against the session that issued it, and it is unique within that session. Ordinary bursts may wait within the original invocation deadline. Sustained waiting is visible in the human workbench; it does not create a new tool call or a popup. An exceptional admission capacity refusal returns `reason: capacity`, no effect, and safe guidance for a request that never started. A person's Pause or End session preserves its fixed directive and terminal history without repeated guardrail popups while queued work drains (ADR-0160). Ordinary page tools share optional `visual_settle`, default true: read, inspect, find, screenshot, click, scroll, hover, fill, type, key input, drag, upload and script execution. Settlement is best effort, with one maximum 1000 ms preparation budget per invocation. A quiet page completes preparation sooner; a busy page remains usable after that budget. False skips implicit waiting. Lookup and execution share the budget; each flow child has its own preference within the parent deadline. Actual targets and permissions still apply. Composite waits keep a met primary condition when optional settlement expires and report `visual_settled` separately. An explicit `visual_settle` wait retains its condition. See [ADR-0195](../adr/0195-bounded-settlement-and-subject-scoped-page-work.md). ## Server instructions Every protocol edge sends the same service-owned instructions at initialization, except a connection that stands by (below). A client that loads tool schemas lazily picks its first calls from this text alone, so it teaches the working loop in six short sentences and names only catalog tools: > Ghostlight controls the user's visible Chromium browser. Open or reuse a tab with > browser_navigate, or list this session's tabs with browser_tabs; omit tab when one tab is > unambiguous, but when other agents may share the session, open your own tab with > browser_navigate new_tab:true and pass that tab on every call. Read a page with browser_read, > and get handles for its controls from browser_find or browser_inspect, which also show what > each form control accepts. Act with those handles, for example with browser_click or > browser_fill_form; timeout_ms bounds the whole call. Handles expire when the page navigates; a handle follows its > control through a re-render the page can prove, and a stale handle's refusal says why. Every > result states its effect and whether repeating it is safe. One agent gets one set of tools. When a second connection comes from the same running app of the same agent, such as Claude Code with both the plugin and the installer's entry, its first `tools/list` returns no tools and its instructions say only this: > Ghostlight is already connected to this agent through another server entry, so this one offers > no tools. Use the Ghostlight tools you already have; if that connection ends, this one offers > them. When the connection that offers the tools ends, the one that stood by sends `notifications/tools/list_changed` and lists the whole catalog. The process is the one Ghostlight observed start the connection, never a client's claim; see ARCHITECTURE and [ADR-0203](../adr/0203-one-owner-for-each-fact.md), amendment of 2026-10-19. ## Result envelope Every invocation returns one envelope: | Field | Type | Meaning | | --- | --- | --- | | `history_storage` | enum | `saved` or `unconfirmed`; storage confirmation is independent of browser effects. | | `invocation` | string | Opaque correlation handle. | | `status` | enum | `succeeded`, `blocked`, `failed`, `cancelled`, or `unknown`. | | `effect` | enum | `none`, `applied`, `partial`, or `unknown`. | | `readiness` | enum | `not_applicable`, `loading`, `interactive`, `complete`, or `unknown`. | | `repeat_safe` | boolean | Whether repeating the same call is known safe. | | `summary` | string | Bounded Ghostlight-authored explanation. | | `facts` | object | Tool-specific canonical facts. | | `next_steps` | string array | Zero to two Ghostlight-authored safe suggestions. | The canonical envelope stays inside the service for audit, history, flow references and the workbench. The MCP edge renders the lean model view of it (ADR-0198 Decisions 21 and 22), once, in `structuredContent`. The view is the same envelope with every field at its default left out, and an absent key means its default: - `history_storage` of `saved`, `readiness` of `not_applicable`, and an empty `next_steps`, on the envelope and on each flow step result; `history_storage` of `saved` on a flow step row. - `facts.coverage` when nothing limited the read (see Document coverage). - On each entry of `facts.items` and `facts.matches`, an empty `state` and a false `credential_class`. - On each `facts.tree` node, an empty `label` and an empty `children`. `status`, `effect`, `repeat_safe`, `summary`, `invocation` and `facts.tab` always stay. Explicit facts stay at any value, including a `value` of `""` or `"[hidden]"` and a `history_storage` of `unconfirmed`. Page data is never rewritten: a script's `facts.value` reaches the client exactly as the script returned it. The edge adds no field and changes no value. The ordinary text block carries the authored summary and safe next steps. A session negotiated at an MCP revision before 2025-06-18 cannot read `structuredContent`, so its text block also carries the same lean JSON after them (ADR-0198 Decision 24). Bounded rich content crosses the relay in a separate generic content vocabulary. `browser_screenshot` returns an image block. `browser_record` save returns a GIF image block only when the caller asked for the replay itself; a save that stays inside the browser returns none. Image bytes are not copied into structured facts or the textual JSON projection. The language context produces `summary`, `next_steps`, and the content-minimized observation projection from one typed outcome or refusal. A sentence that names a host, count, or capture size carries the same value in that projection. Ghostlight owns the sentence. The browser may return the role and accessible name of the physical element in the same action receipt, without a describe round trip. The role is narrowed to a closed Ghostlight noun; an unknown role becomes `control`. The name is normalized, bounded to 80 visible characters, and included by default, so an action can say `Clicked the "Save" button on example.com.` Governance may remove all target names with `privacy.preserve_target_names: false`, leaving `Clicked a button on example.com.` Editable values are never name sources. A result with `effect` equal to `partial` or `unknown`, or with a committed effect unsafe to duplicate, has `repeat_safe: false` and does not suggest replay. Refusals say what is true, and their next steps suggest only what the caller can do: - A cancellation says who cancelled: the agent, the end of the agent's session, or Ghostlight's quit. One that wins before the call starts answers, for example, `The agent cancelled the browser job before it started.`, and one that wins before any browser command answers `The agent cancelled before anything reached the browser.`, `The agent's session ended before anything reached the browser.` or `Ghostlight quit before anything reached the browser.`, each with status `cancelled`, no effect, and no next step. A cancellation the browser reported without one of these causes answers `Cancelled before anything reached the browser.` None of them says the browser disconnected. A call that arrives while Ghostlight is ending, or after the end stopped its session, gets this tool result and an audit line too, never a protocol error: `Ghostlight quit before the browser job started.` After a quit, a replacement, an idle exit or a reason this build does not know, its one step is `Try the call again in a moment.`, because the edge reconnects; after an uninstall or the end of the person's sign-in session it has none. - A browser that cannot take a call is waited for first when there is evidence it is coming back. A session that already works in a browser always waits for that browser. A session with no browser yet waits only while a connection is registered but initializing or silent, a browser connection ended less than the wait ago, or the service published its endpoint in the last 1.5 seconds, or within the wait after it replaced a service that just ended, in a home that remembers a browser. It stops waiting as soon as none of these holds, so a browser closed long ago goes straight to browser startup with the whole deadline to launch it. The wait lasts up to about seven seconds and ends early enough to leave the call time to run. A silent browser gets one liveness probe at once. Under `on_demand`, when Ghostlight knows which installed browser a session's own browser is, the session waits only while a browser is evidently returning, and a browser still gone after that is started again, so the start keeps the call's budget. The call then goes through when the same browser connects within the wait that follows the start, even after another profile of it connected first. Nothing is started while that installed browser is already connected under another identity. A start whose adapter never connects is `browser_handshake_timeout`, with the words every browser start has. A retry within 30 seconds of a start that has not connected waits for that start instead of starting the browser again, so repeating the call after a handshake timeout is safe. No new sentence is needed (ADR-0196 Decision 12 amendment, 2026-10-17). Otherwise a session that already works in a browser is never sent to browser startup. A session whose browser stayed away while exactly one other browser is connected moves to that browser, and the call runs there. One connected browser is no choice, so the result says nothing about the move: no refusal, no fact, no sentence. The process log records it, and the audit record and the window name the browser each action ran in. Every tab the session held in the browser that left reads as no longer open, so a call that names one of them is told that (`tab_unavailable`) and reaches no browser; `browser_navigate` with such a handle keeps its usual recovery and opens the page in a new tab, saying the old tab was gone (ADR-0196 Decision 12 amendment, 2026-11-13). Otherwise the refusal says which fact stopped the call, with `failed`, no effect, and `repeat_safe: true`: | Fact | `reason` | Summary | Next step | | --- | --- | --- | --- | | Connected but not answering | `browser_not_answering` | `The browser this session works in stopped answering. Nothing was sent.` | `Check that the browser window is open and responsive, then repeat the call.` | | Not connected, no other browser is | `browser_disconnected` | `The browser this session works in is not connected. Nothing was sent.` | `Ask the user to reopen that browser, then repeat the call.` | | Not connected, several other browsers are | `browser_wrong_profile` | `This session works in a browser that is not connected, and more than one other browser is. Nothing was sent.` | `Ask the user to reopen the browser this session started in, then repeat the call.` and `To work in one of the connected browsers instead, call browser_tabs with action list, then browser_navigate with new_tab true and that browser.` | | Connection busy with other work | `browser_busy` | `The browser connection was busy, so nothing was sent.` | `Repeat the call.` | | Bridge contract failure | `browser_contract_failed` | `Ghostlight and the browser extension do not agree on this request.` | `Ask the user to update Ghostlight in Browser (to update now, open chrome://extensions, turn on Developer mode and click Update), then repeat the call.` | None of these says "disconnected" for a browser that is still attached, and none tells the model to reconnect an adapter it cannot reach (ADR-0196 Decision 12). A session whose browser is not connected also moves when the agent names a connected one with `browser_navigate`, `new_tab` true and `browser`: it leaves its browser, every tab it held there reads as no longer open, and the new tab binds the named browser (arch-1 W-D5). A named browser is always the one used. Among several connected browsers the session never moves by itself, because choosing between the person's signed-in browsers is a different act from the one asked for (ADR-0084 Decision 4). While the session's browser is connected, naming another stays `browser_pinned`. The contract summary does not say whether anything was sent. A receipt in the wrong shape arrives after the browser already received the request. - A deadline before dispatch suggests a longer `timeout_ms` only when the call's own value is below the 30000 ms maximum. The deadline comes only from that field. Every tool takes it, so the suggestion always describes a call the decoder accepts. Calls already at the maximum (such as `browser_fill_form` with its default) are told to repeat the call and narrow a very large page first. A deadline after dispatch has an unknown effect, so it says to check the page with `browser_read` or `browser_screenshot` before repeating. The `timeout_ms` of a decoded operation is the one record of its call time, and the deadline itself is derived from it. - A policy denial (host, protected host, capability, tab close, screenshot, or an unspecified policy reason) points to `policy_explain`. Pause, Stop, a required-history outage, and an unreadable policy keep no next step. - A request on a channel a policy turned off is refused before any browser work, `policy_explain` included, with `blocked`, `reason: channel_denied`, no effect and `repeat_safe: true`. The summary names the switch and whose policy turned it off: `Blocked: the user's Ghostlight policy turns off work from MCP agents.`, or `the organization's`, and `from the command line.` for `ghostlight call`. It keeps no next step, because the caller cannot turn the switch back on. The connection stays open, so every call on it hears the same refusal (ADR-0202 Decision 22a). The window's row and its permission details say it to the person instead: `Your policy turns off work from MCP agents.`, or `Your organization's policy`. In the same way a pause or a stop reads `You paused Ghostlight.` or `You ended the session.` in the window, while the model keeps its directive (`language/history.rs`). - A refusal of Ghostlight's own control page names the origin as the caller wrote it (scheme, host and port, never a path) and says other ports on this computer are not affected. It keeps no next step, because no policy lifts it. History records the reason and the host, never the origin. `policy_explain` lists the control page among the ceilings no policy can lift. - The preserve-tabs veto says the tab stays open because the user chose to keep Ghostlight's tabs, and to continue without closing it. - A workspace refusal found after the browser already acted, such as a tab the browser opened that another session in the same browser controls, keeps its reason but reports `effect: applied` and `repeat_safe: false`, because repeating it would act again. The same language owner supplies a separate typed audit projection. Readable explanations, measurements, and governed target names survive; arbitrary browser details and result facts do not enter retained history. That holds through every wrapper: a fill that raises a dialog or whose `expect` falls short keeps no field value, and an ownership refusal keeps no other session's name (ADR-0203 Decision 4.1). A permitted client result may still contain those details. Expanding existing history does not authorize more capture. Additional retention profiles and richer diagnostic capture remain deferred (ADR-0103 H1 amendment). When no browser is connected and startup is left to the person -- because `browser.startup` is `manual`, or because more than one installed browser could serve and none of them is a usable browser that last connected to Ghostlight -- the refusal addresses the MCP model: ask the user to open one of the eligible installed browser windows it names, with the Ghostlight extension installed, then repeat the call. Facts carry the closed `browser_startup_manual` reason and a `browsers` array; one choice also retains the singular `browser` fact. The summary contains the whole recovery instruction, so `next_steps` is empty, with one exception: while setup is incomplete and no browser profile holds the extension, one step asks the user to add Ghostlight in Browser from the store listing, or to open the Ghostlight window for the setup steps (ADR-0200). The same step replaces the extension-absent recovery step, and the step after a launched browser whose adapter never arrived, under the same condition. Stale Ghostlight-owned registrations among several installed browsers are repaired silently first, so the named browsers can actually connect; when no installed browser has a usable registration, the refusal names the browsers found and one choice-free remedy instead. No browser refusal ever says that Ghostlight declined to choose. Under `on_demand`, the browser that last connected is started instead of asking, so no new sentence is needed for it (ADR-0149 amendment, 2026-10-17). When the registration names the edge of a different Ghostlight installation, recovery changes nothing and answers `Another Ghostlight installation owns the browser registration.` with the `native_host_owned_elsewhere` fact and one next step: the user runs `ghostlight install` from the installation that should own the browsers. Silent repair applies only to stale details within the running installation's own directory (ADR-0149 amendment). ## Catalog ### `browser_tabs` List, focus, or close controlled tabs. Actions are: - `list`: no `tab`; shortest call `{}`, since `list` is the default; capability `read`. A session that holds tabs reads the list live from its browser on every call and names only its own tabs, so it needs that browser connected and refuses without it. It first confirms any tab remembered across a browser or service restart, and a tab the browser does not confirm is left out. A session that holds no tab answers at once, asking no browser: `Listed 0 tabs in this session.`, `tabs: []`, the connected browsers, and the step `Call browser_navigate with url to open a page.` It never waits for, starts or binds a browser, so the browser it names can still be chosen for the first tab (ADR-0203 Decision 2.2). The summary otherwise reads `Listed 2 tabs in this session.` - `focus`: required `tab`; no RAWX capability. - `close`: required exact `tab`; capability `action` on the tab's host, then the tab-close policy constraint. A tab a refused landing left held, or one already gone, is closed under the person's runtime controls and the tab-close setting alone. Close also respects the browser's local preserve-tabs interlock. Facts for list contain `tabs` and `browsers`. Each tab has `tab`, bounded `title`, governed `url`, `active`, and `readiness`. A tab whose page the policy refuses Read on keeps `tab`, `active` and `readiness`, has no `title` or `url`, and names its `host` (null when the address has none) and the refusal's `reason`, as a held tab's refusal names its host. Each entry of `browsers` has `browser`, `name` and `attended`. Focus facts include `tab`, `active`, and `window_focused`. Close facts include `tab` and `closed`. ### `browser_navigate` Navigate to a governed URL. Shortest call: `{"url":"https://example.com"}`. Rules: `tab` and `new_tab:true` cannot be combined. `new_tab:true` always creates a tab, so `reuse` beside it changes nothing, its advertised default `domain` included. `beforeunload:"discard"` accepts just that navigation's own unsaved-change prompt; without it, a blocking prompt stops the navigation and is reported, never accepted. With `new_tab:true`, Ghostlight creates and navigates a new controlled tab. With `tab`, it navigates that exact tab. With neither, it uses the unambiguous controlled tab, and when none exists it opens one. With `reuse:"domain"`, the open first reuses a tab Ghostlight opened on the same host and port and a released session of the same agent left open, in the same browser, with no page loaded in it since the release. Same agent means the agent the opener's claim names: every command-line session is the command line, a claim the catalog knows is that agent, and any other claim is an unknown agent under its claimed name. The reused tab goes back into the caller's group, the one titled with the ghost emoji (U+1F47B) and the agent's name. A tab another agent released is never reused, and the open creates a fresh tab. A client that claims no name reuses no kept tab, and no one reuses its tabs. The claim is a courtesy between well-behaved clients, never authority (ADR-0203 Decision 9). A released tab stays open only when the person's preserve-tabs setting kept it, so with that setting off nothing is reused. An exact URL wins, then the lowest tab id. The service makes that choice, checks that the browser still shows the tab at its release address, and navigates that exact tab. A tab the person opened is never reused, and the browser is never asked to pick one (ADR-0196 Decision 9). `reuse:"never"` always creates a fresh tab. A reused open says so: the summary reads "Reused the example.com tab." rather than "Opened example.com." Capability: `read`. Facts: `tab`, governed `url`, bounded `title`, `created`, `reused`, and `document_generation`. ### `browser_history` Move through history or reload. Shortest call: `{"action":"back"}`. Rules: `bypass_cache:true` is valid only for `reload`; `false`, its default, goes with any action. Capability: `action`. `back` and `forward` go to the tab's previous or next history entry exactly, as the page's own `history.back()` does. The browser's back button skips a page the person never interacted with, so an agent that moved between pages with `browser_navigate` alone would otherwise land nowhere. With no page that way the call is refused before anything is sent: `This tab has no earlier page in its history, so nothing was sent.` (or `no later page` for `forward`), with the `reason` fact `no_history_entry` and the next step `Call browser_navigate with url to open a page.` An extension older than 2.0.1 uses the back button's rule. Facts: `tab`, `action`, governed `url`, bounded `title`, and `document_generation`. ### `browser_window` Set tab zoom or resize the containing browser window. - Zoom: `{"percent":100}`. Requires `percent`; capability `read`. - Resize: `{"width":1280,"height":800}`. Requires `width` and `height`; no RAWX capability. The action may be left out: `percent` means zoom, and `width` and `height` mean resize. Resize affects every tab in the window and may rerender the page. Either action invalidates a current view handle when its bound geometry no longer matches. Facts include the selected tab, action, requested dimensions or zoom, and observed geometry. ### `browser_read` Read useful bounded visible text from the full composed page or one target. A full-page read includes visible top-document text, open shadow trees, and http(s) embedded frames in stable frame order. Visible form values are included, checkboxes and radios read as checked or unchecked, and placeholders are never values. Every credential-class field, as the write path classifies it, is masked: its value reads as the short marker `[hidden]`. Closed shadow roots and hidden content remain absent. Use `browser_inspect` or `browser_find` when an action target is needed. A read of one native select returns its chosen text and then a last line, `Options: ` followed by every option in order and separated by semicolons, bounded only by `max_chars`; a disabled option reads `(disabled)`. This is the way to see an option list that an item cut at 25. A credential-class select reads `[hidden]` and lists nothing. Shortest call: `{}`. Rules: `mode` defaults to `visible`; explicit `article` prefers a useful article in the top document and falls back to the same full-page visible read, and is ignored with `target`. Capability: `read`. Facts: `tab`, governed `url`, bounded `title`, `text`, `truncated`, and `document_generation`. ### `browser_inspect` Inspect semantic controls or page structure. The `controls`, `structure`, and `all` scopes return fresh target handles; the `document` scope returns the page outline as a tree. Shortest call: `{}`. Rules: `root` and `max_depth` belong to the `document` scope. Capability: `read`. Facts: `tab`, `document_generation`, and `items`. Each item has a target handle, an accessibility role, bounded accessible name, state, and credential-class flag, and a control adds the keys in the table below when they apply. An element with no role of its own reads as `generic`, never as a tag name. Native controls have their HTML-AAM roles: a range input is a `slider`, a number input a `spinbutton`, a search input a `searchbox`, a select that takes several choices or shows more than one row a `listbox`, and any other select a `combobox`. An input of type hidden is not a control and is never listed. A field with no label, `aria-label` or title is named by its placeholder, as browsers do, so `browser_find` and semantic selectors reach it by that text. Selectors are not exposed. It answers once the page has been quiet for 300 ms, within the settle budget. Item keys beyond the five above appear only when they apply, so an absent key means the page offered nothing of that kind: | Key | Meaning | |---|---| | `value` | What the field holds, at most 80 characters, with `value_chars` (the full length) when longer. Empty when the field is empty or a select shows its empty placeholder option. A multiple select gives an array of at most 25 chosen texts. Covers text fields, textareas, native selects, rich editors, range and number. | | `options` | A native select only, in document order, at most 25 entries of 60 characters, with `options_total` when cut. An entry is the bare text, `{"text","value"}` when the text is not unique, `{"text","disabled":true}` when the option or its optgroup is disabled, or `{"group","options"}` for an optgroup. The placeholder is the first option when its value is empty; it is left out and shown as `hint`. Any other option with an empty value is a real choice. | | `type` | The input type, only for `date`, `time`, `datetime-local`, `month`, `week`, `number`, `range`, `color`, `file`, `email`, `url` and `tel`. | | `limits` | The constraints the page declared, among `min`, `max`, `step`, `minlength`, `maxlength`, `pattern`, `accept`, and `multiple:true`. | | `hint` | A placeholder that says something other than the name, else the text `aria-describedby` points to, else the select's placeholder option. At most 120 characters. | | `group` | For a radio or checkbox, the fieldset legend or the nearest labelled group. At most 80 characters. | | `context` | The label of the control's row or group, only when its role and name repeat among the results. A row is the nearest list item, table row, article, tree item, named group or fieldset; its label is the name the page declares, else a legend, else its first heading, else its first link's text. With no row, the group or the nearest named region or panel. One line of at most 80 characters, never a field's value. Never on a credential-class control. | | `nth` | The control's position, counted from 1 in document order, among the results that share its role, name and context. Present only when that set has two or more. Counted over the whole page's results, across frames, after any cut. For display only; use the handle to act. | | `error` | Present when the control is invalid after the person touched it, or the page says `aria-invalid`. The page's own error text when it names one; otherwise a phrase such as `is required`, `is not a valid email address` or `is too short (at least 8 characters)`. The browser's validation message is never used except for a custom error. | Any item, control or not, also says where it sits, with these keys only when they apply (ADR-0198 decision 19): | Key | Meaning | |---|---| | `area` | The page area that holds the item: `header`, `nav`, `aside`, `footer`, `dialog` or `search`. A native `header` or `footer` is a page area only when no `article`, `aside`, `main`, `nav`, `section` or dialog contains it; inside a dialog it reports `dialog`. Absence means page content. | | `form` | The number of the form that owns the item, counted from 1 over the forms of the page in the order they appear, frames included, so a number keeps naming the same form from one call to the next. The `form` attribute counts, and so does a control inside a component that sits in a form. Absence means no form owns the item. | Items come out in the order the page shows them, including content inside components. When the page has more than `max_items`, the cut goes by tier and never by position: hidden items go first, then items in a header, nav or footer, then asides, and page content last. Content here means everything else, including dialogs, forms, the main region and search. Within a tier the earlier items stay, and what is kept stays in page order, so a long navigation bar does not push the form out. The fact `left_out` counts what was left out, by `hidden`, `chrome` (header, nav and footer), `aside` and `content`, and shows only the keys that have a count. The result then adds a next step that gives the number and the two ways to reach an item: raise `max_items` (up to 200) or use `browser_find` for one by name. The summary does not change. A control that cannot be acted on is not listed at all, and is counted as `behind_dialog`: one under an `inert` ancestor, or outside an open modal dialog. It does not use up `max_items`, and it does not make the result "reach its size limit". When a modal dialog is open the facts also say `modal_open:true`. Structure items such as headings and landmarks stay listed. `browser_find` cuts by the same tiers when it has more matches than `max_results`. State words gain `required`, `readonly` and `invalid`. A control inside a disabled fieldset reads `disabled` and is refused as not actionable, as one with the `disabled` attribute is. A control is credential-class by its type, its autocomplete token, or its name or id, which is split at camelCase before matching, so `apiKey`, `cardNumber`, `userPin`, `ssn` and `iban` count. A credential-class control carries `value` as `[hidden]` when set and empty when empty, and none of the other keys. Option text, hints and errors are page content and follow read authorization on the document, like `browser_read`. A `document` scope returns no target handles. Its facts are `tab`, `document_generation`, `tree`, `nodes`, `truncated`, `snapshot`, and sometimes `diff`. `tree` is one bounded structure-only composed tree. Each node has a `kind` of `control`, `heading`, or `container`, a `label` of at most 120 characters, and a `children` array. A control or heading is labelled by its accessible name. A container is labelled only by a name the page declared for it, and by no text from inside it, because its descendants carry that text themselves. An unlabeled container whose children were all left out is itself left out and does not count against the node ceiling; a container cut by depth or budget stays, and so does the root. Without a root, the tree includes open shadow roots, assigned slots, and http(s) embedded frames in stable order under one 400-node ceiling. A root limits it to that target's composed subtree. Editable values, hidden content, closed roots, and frame identity are never returned. A summary reads, for example: `Returned the document outline: 283 nodes.` The tree is also recorded under a `snapshot` handle, superseded per tab. When the previous snapshot of that tab, in the same document, used the same `root` and `max_depth`, the result adds `diff` and the summary counts the differences, or says the outline matches the previous one. Trees of another root or depth are never compared, because they differ without the page changing. `diff` compares nodes by position and counts `added`, `removed`, and `changed` nodes. Its `paths` list up to 50 positions in the returned `tree`: `/` is the root and `/1/0` is the first child of the root's second child. A path names a new node, a node whose kind or label changed, or a node that lost children. ### `browser_find` Find current semantic targets by visible or accessible text across the composed page, including open shadow roots and http(s) embedded frames. Use it when the desired label or text is known. Text search also matches `div`, `[draggable]`, `[aria-label]`, and `[tabindex]` elements, and prefers the deepest match over a container that only holds it. Names never include field values. Option text finds its dropdown. A credential-class dropdown is never found by its options. Shortest call: `{"text":"Submit"}`. Capability: `read`. Facts: `tab`, `document_generation`, and bounded `matches` in document order with target, role, name, and state, and the same optional control keys as `browser_inspect` items. When a role and name repeat among the results, each carries `context` (the label of its row or group) and, when that repeats too, `nth` (its position among those, in document order). A unique control carries neither. It answers once the page has been quiet for 300 ms, within the settle budget. ### `browser_screenshot` Capture the viewport, full page, one target, or a magnified region from a current view. Every capture returns a view handle for later coordinate actions or another region capture. Shortest call: `{}`. Rules: the decoder accepts one of four branches: viewport capture with no other capture field; `full_page:true`; `target`; or a region with `view`, `x`, `y`, `width`, and `height`. Region coordinates are image pixels and must form a positive rectangle wholly inside the current view. Target, full-page, and region capture cannot be combined. Capability: `read`. Facts: `tab`, `view`, `mime_type`, `width`, and `height`, plus one bounded MCP image content block. ### `browser_click` Click a current semantic target or a point in a current screenshot. Shortest call: `{"target":"target_..."}`. Rules: exactly one location branch: `target`, typed semantic `selector`, or `view` with `x` and `y`. `click_count` 1, 2 and 3 are a single, double and triple click. Capabilities: `action`, plus `read` when `selector` or `expect` is supplied. Facts: `tab`, optional `target`, optional `view`, `activated`, `rebound: true` when the target handle followed its control through a re-render, and any governed committed landing. ### `browser_scroll` Scroll in a direction or reveal a semantic target. Shortest call: `{}`, which scrolls a medium amount forward on the axis the page scrolls on: down on an ordinary page. Rules: one of three branches: `target` to reveal; or a page scroll by `direction` and `amount`; or coordinate wheel input with `view`, `x`, and `y`, whose `direction` is `up` or `down`. `amount` is pixels (`600` or `"600px"`), a share of the view (`"50%"`), `small`, `medium`, `large`, `page`, `top`, `bottom`, or `end`; a negative distance goes the other way. A page scroll moves the document, or else the scrolling container under the middle of the viewport, and with no direction never turns back at the end. Beside `target`, `direction` and `amount` are ignored. At a view point an `amount` becomes `ticks` (about 100 pixels each, 4 when neither is given); `ticks` without a view is a page scroll of that many hundred pixels. Capability: `read`. Facts: `tab`, optional `target`, `scrolled`, observed horizontal and vertical offsets, and for a page scroll the `direction` it went, the pixels it `moved`, and `at_end`. When nothing moved the effect is `none` and the summary says the page is at its end or does not scroll that way. ### `browser_hover` Hover a current semantic target or a point in a current screenshot. Shortest call: `{"target":"target_..."}`. Rules: exactly one location branch: `target`, or `view` with `x` and `y`. Capability: `read`. Facts: `tab`, optional `target`, optional `view`, and `hovered`. ### `browser_fill_form` Fill one or more form controls. It does not submit unless `submit_target` is present. Use `browser_type_text` when per-character input events matter. Shortest call: `{"fields":[{"target":"target_...","value":"Ada"}]}`. Rules: each field has exactly one location, `target` or typed semantic `selector`. Capabilities: `read + write` without submit and `read + write + action` with `submit_target`. Ordinary textual inputs, textareas, and rich-text controls use the browser's editing transaction so controlled forms and editors retain the replacement across later renders. Selects, checkboxes, and radios keep their semantic control setters. Empty values clear only the named control. Filling never activates a submit control unless the caller supplied `submit_target`. Form preparation shares the call's settle budget; only `visual_settle` false skips it. Active controlled tabs emulate focus between calls to avoid focus-triggered refresh interrupting automation (ADR-0168). Pause, stop, disconnection, and release restore normal browser lifecycle. An application can still reset its own form, especially after control ends; a fill result does not claim that the draft was saved or will survive future application refreshes. Semantic selectors and target handles can address the same ordinary controls, including editors outside an HTML `form`. The selector does not impose an unadvertised form-ancestry requirement. An explicit `submit_target` is still checked against the first resolved field's containing form. How a value picks a choice (ADR-0198 Decisions 8 and 9). One page routine decides it for the check before the fill, the fill, and the check that the page kept the value, so they cannot disagree. For a select, an option answers to its value, its text and its label. A value that is exactly one of those picks that option. If two or more options answer to it exactly, the fill is refused with their values. Only when no option answers exactly does the page compare again after Unicode composition, trimming, white space collapse and case folding on both sides. One match picks it, and the result says so: `Filled 1 field on example.com: Role = Administrator (matched "administrator").` The facts carry `"match":"normalized"`. No match, or several, is refused with the options. There is no prefix, substring or closest match, and Ghostlight never picks an option the value does not name. An option that is disabled, or inside a disabled option group, is refused as disabled. An empty string picks the empty placeholder option, and the result reads `no value`; no other text picks a placeholder. A multiple select takes a list, each entry resolved by these rules, and ends up holding exactly that set; an empty list clears it. A single string on a multiple select picks only that option. A list given to any control that takes one value is refused. A checkbox takes a boolean or one of `true`, `false`, `yes`, `no`, `on`, `off`, `1`, `0`, `checked`, `unchecked` without regard to case, sets that state and never toggles it. Any other word is refused and nothing changes. A radio takes a boolean for itself. A string is matched, by the select rules, against the labels of the radios in its group (same name, form owner and root) and picks the radio it names, which may be a sibling of the target. A string that names no label but is one of the boolean words applies to the target radio. Any other string is refused with the group and its labels. A fill that cannot take its values refuses before any edit and says what would succeed (ADR-0198 Decisions 8 and 10). The page checks every field first, so one refused call names every field that cannot take its value, never only the first. The result has status `failed`, effect `none`, and is safe to repeat. The summary starts `Nothing was changed.`; when more than one field is refused it starts `Nothing was changed: N of M fields cannot take their values.` Then one clause follows for each field, for example `The "Role" dropdown has no option "Engineer". It offers: Developer, Administrator, Researcher, Other.` The next step names the handle and the route, at most two steps in all: `Repeat browser_fill_form with target_... set to one of the offered options.` The clauses by problem word: | Problem | Clause | Next step | | --- | --- | --- | | `option_missing`, 25 options or fewer | `The "" dropdown has no option "". It offers: A, B, C.` When the names are too wide for one clause: `It offers: A, B and 12 more, all in the facts.` | `Repeat browser_fill_form with target_... set to one of the offered options.` | | `option_missing`, a longer list, or a list the page sent without its options | `... has no option "" among its 195 options.` and `Options containing "": X, Y.` when any | `Read target_... with browser_read to list all its options.` | | `option_missing`, after an earlier choice field in the call | the clause above, then `Its options can depend on earlier fields.` | `Fill the earlier fields first, then repeat for target_....` | | `option_missing` on a radio button | `The "" choice has no option "". It offers: Standard, Express.` | `Repeat with one of the offered labels for target_....` | | `option_ambiguous` | `"" matches 2 options of the "" dropdown: Other (value other-staff), Other (value other-guest).` For a list, `` is the entry that matched twice. | `Repeat with the option's value for target_....` On a radio: `Find the radio you mean with browser_find, then fill that radio's own handle with true.` | | `option_disabled` | `The option "" of the "" dropdown is disabled.` | `Choose an enabled option, or inspect the form for the field that enables it.` | | `multiple_values` | `The "" dropdown takes one value, not a list.` | `Repeat browser_fill_form with target_... set to a single value.` | | `not_boolean` | `The "" checkbox takes true or false, not "".` | `Repeat with true or false for target_....` | | `format` | `The "" date field takes YYYY-MM-DD, not "".` and `Allowed: 2026-10-01 to 2026-12-31.` when the control declares limits. A range always has them: `Allowed: 0 to 100, in steps of 10.` | `Repeat browser_fill_form with target_... set to a corrected value.` With two or more fields to correct (`format`, `not_boolean`, `multiple_values`), one shared step: `Repeat browser_fill_form with corrected values for target_14 and target_15.` | | `wrong_tool`, a file input | `The "" field is a file input.` | `Attach the file with browser_upload on target_....` | | `wrong_tool`, a button, or a submit, reset or image input, whatever role it carries | `The "" control is a button, not a field.` | `Click it with browser_click on target_....` | | `wrong_tool`, a page widget | `The "" dropdown is a page widget, not a form field.` | `Open it with browser_click on target_..., then browser_click the option by name.` | | `submit_not_owned` | `The submit control does not belong to the form that holds these fields.` | `Repeat without submit_target, then click the submit control with browser_click.` | Typed inputs take the ISO shapes (ADR-0198 Decision 10). The page checks `date`, `time`, `datetime-local`, `month`, `week`, `number`, `range` and `color` before any edit by assigning the value to a detached input of the same type with the same `min`, `max` and `step`, and reading it back. The value must come back as given and inside the declared range. A range input also moves a value to its nearest step and into its bounds, whatever the page declares (0 to 100 in steps of 1 when it declares none), so a range value it would move is refused and the refusal names the bounds and the step in force. A range with the step `any` is clamped but not snapped, so its refusal names the bounds only. A number written in another form, such as `20.0` for `20`, is the same number and is accepted. The shapes are `YYYY-MM-DD`, `HH:MM`, `YYYY-MM-DDTHH:MM`, `YYYY-MM`, `YYYY-Www`, `a number` and `#rrggbb`. There is no lenient date parsing: `10/14/2026` is refused, not guessed at. A color compares without regard to case. An empty value clears a field, except a range, which has none. A number input keeps a value that does not land on its step and is not refused; the field's invalid state shows it. Wrong tools are named instead of failing in the page: a file input (use `browser_upload`), a `