## Browser agent interface

### When to use—and when not to

Use the interface to read authored chapters\,&#32;navigate the workbook\,&#32;select the fictional illustration\,&#32;open disclosures\,&#32;inspect tutorial state or operate an explicitly requested local lesson checklist\.&#32;Do not use it to search\,&#32;save\,&#32;correct or erase actual OMP memories\,&#32;run terminal commands\,&#32;authenticate to OMP or establish database health\.&#32;No REST endpoint or MCP service is provided by this site\.

Open the&#32;[canonical homepage](<https://present-sketch-tp94.here.now/labs/memory>)&#32;in a JavaScript\-capable browser and evaluate in the&#32;**page’s main JavaScript world**\.&#32;The API is&#32;`window.memoryTutorial`\,&#32;version 1\.&#32;A fetch\-only document reader\,&#32;an isolated extension world or a support page does not expose this object\.&#32;If it is absent\,&#32;use the authored Markdown for reading\;&#32;do not invent a network API\.

Call&#32;`discover()`&#32;for the live schemas\,&#32;permissions\,&#32;exact control IDs\,&#32;enabled states and gaps\.&#32;These schemas\,&#32;not guesses from visible labels\,&#32;define the currently loaded page’s interface\.

| Operation | Input | Result |
| --- | --- | --- |
| `discover()` | None | Scope\,&#32;permissions\,&#32;schemas\,&#32;controls and gaps\. |
| `inspect()` | None | Authoritative page revision\,&#32;content revision\,&#32;current chapter\,&#32;illustration\,&#32;checklist\/storage\,&#32;clipboard\,&#32;disclosures and stable controls\. |
| `query({text, limit})` | Text of at most 240 characters\;&#32;optional integer limit 1–10\,&#32;default 5\. | Searches authored chapter text\,&#32;including closed disclosures\,&#32;never memories\.&#32;Status is&#32;`matched`\,&#32;`empty`&#32;or&#32;`empty-query`\;&#32;unavailable content is a structured failure\. |
| `act({id, action, expectedRevision, …})` | Exact registered control ID\,&#32;supported action and a fresh revision\. | `performed`&#32;or&#32;`unchanged`\,&#32;`changed`\,&#32;current revision and optional clipboard outcome\. |
| `wait({afterRevision, timeoutMs, match})` | Existing revision from this document\;&#32;optional integer 0–5000 milliseconds\,&#32;default 1500\;&#32;optional&#32;`match`&#32;with&#32;`chapterId`&#32;and\/or&#32;`demoStep`&#32;\(1\,&#32;2 or 3\)\. | `matched`&#32;only after a newer revision satisfying every supplied condition\,&#32;otherwise&#32;`timed-out`\;&#32;includes current revision and state\. |
| `diagnose()` | None | Tutorial runtime\,&#32;storage\,&#32;clipboard capabilities and control integrity—not OMP health\. |

`query()`&#32;matches all whitespace\-separated search terms case\-insensitively within a chapter\.&#32;Results have a chapter ID\,&#32;title\,&#32;anchor\,&#32;navigation control ID and excerpt\.&#32;A chapter excerpt is not the full source text\.

### Read\,&#32;act\,&#32;observe

Run this JavaScript in the homepage’s main world\.&#32;It selects only a fictional stage\:

~~~js
const t = window.memoryTutorial;
const capabilities = t.discover();
const chapters = t.query({ text: "compaction", limit: 3 });
const before = t.inspect();
const result = await t.act({
  id: "demo-recall",
  action: "click",
  expectedRevision: before.revision
});
const observed = result.ok && result.changed
  ? await t.wait({
      afterRevision: before.revision,
      timeoutMs: 1000,
      match: { demoStep: 3 }
    })
  : t.inspect();
const diagnostics = t.diagnose();
~~~

An already selected stage or another unchanged action does not guarantee a newer revision\.&#32;Do not interpret a wait timeout as a successful transition\,&#32;or a successful stage selection as a successful real memory operation\.

### Action shapes and revision rules

- Use&#32;`action: "click"`&#32;for a discovered click control\,&#32;such as a navigation\,&#32;illustration\,&#32;copy or reset control\.
- Use&#32;`action: "setChecked"`&#32;with a boolean&#32;`checked`&#32;only for a checkbox control\.&#32;This changes self\-reported local progress\,&#32;not verified OMP state\.&#32;Do not tick it without the reader’s actual completion or explicit request\.
- Use&#32;`action: "setOpen"`&#32;with a boolean&#32;`open`&#32;only for a disclosure’s&#32;**summary control ID**\,&#32;such as&#32;`settings-extra-toggle`\,&#32;not its containing details ID\.
- Supply&#32;`checked`&#32;only for&#32;`setChecked`\,&#32;and&#32;`open`&#32;only for&#32;`setOpen`\.&#32;Extra or unsupported fields are rejected\.
- Inspect immediately before every action\.&#32;Pass that response’s opaque&#32;`revision`&#32;as&#32;`expectedRevision`\;&#32;do not use&#32;`contentRevision`&#32;or manufacture a token\.
- Revisions expire on reload\.&#32;User actions\,&#32;scrolling and asynchronous clipboard results can change them\.&#32;On&#32;`STALE_REVISION`\,&#32;inspect again and reassess the intended action\.
- Honor&#32;`enabled`&#32;and&#32;`unavailableReason`\.&#32;Disabled\,&#32;hidden\,&#32;inert or closed\-disclosure targets are not actionable\.&#32;Open the appropriate discovered disclosure first\,&#32;then inspect again\.&#32;Never bypass a disabled control by editing the DOM\.
- Actions use the same native click\/change paths as human controls\.&#32;A structured success is not permission to claim unobserved effects\.

For example\,&#32;open the configuration disclosure without changing a setting\:

~~~js
const t = window.memoryTutorial;
const before = t.inspect();
await t.act({
  id: "config-options-toggle",
  action: "setOpen",
  open: true,
  expectedRevision: before.revision
});
~~~

### Failures and boundaries

Failures use&#32;`{ok:false, error:{code,message}}`\,&#32;with revision\/scope metadata and optional details\.&#32;The discovery schema lists&#32;`INVALID_ARGUMENT`\,&#32;`STALE_REVISION`\,&#32;`STALE_DOCUMENT`\,&#32;`INVALID_REVISION`\,&#32;`UNKNOWN_TARGET`\,&#32;`AMBIGUOUS_TARGET`\,&#32;`DISABLED_TARGET`\,&#32;`UNSUPPORTED_ACTION`\,&#32;`ACTION_FAILED`\,&#32;`UNAVAILABLE`&#32;and&#32;`BUSY`\.

Clipboard access depends on browser policy and user activation\.&#32;Inspect the returned outcome\;&#32;copying may require manual selection\.&#32;A timed\-out attempt is unconfirmed\,&#32;not proof that a later browser write is impossible\.&#32;Saved checklist state reports the last local observation\,&#32;without multi\-tab locking\.

The API requires no login\,&#32;API key\,&#32;authentication or payment\.&#32;It operates the tutorial only\:&#32;no OMP\,&#32;filesystem\,&#32;credentials\,&#32;real memories\,&#32;command execution or network requests from its script\.&#32;`diagnose()`&#32;cannot assess your OMP installation\.
