diff --git a/CAPABILITIES.md b/CAPABILITIES.md index 306c5c9da3..d254ffdf89 100644 --- a/CAPABILITIES.md +++ b/CAPABILITIES.md @@ -57,8 +57,18 @@ monorepo and installable from source. (`compose`, `process`, released), and one program can switch surfaces, tabs and popups mid-run ([#1197](https://github.com/OpenAdaptAI/OpenAdapt/pull/1197)). 5. **Confirms the right record before every write and reads it back after.** - The record check reads the system of record (API, database, FHIR with SMART - Backend Services, or a separate signed-in session), never just the screen. + A run is `VERIFIED` only when a read outside the acting session confirms the + save: the system of record (API, database, FHIR with SMART Backend Services, + a log or an export) or a separate session (a fresh sign-in on the web; on + desktop, a fresh session or a relaunch of the app, as the deployment + declares). A read on the acting screen gets its own level and never + verifies a run. The run report names the level for each save with a + declared read-back. Where the app's own screens are the only independent + read, the check covers at most the target record, plus the same actor's + changes in the app's activity log within a stated window where the app + shows one and the program is set up to read it; other records, later + server-side jobs and outbound messages are not covered. The wire check is + evidence of what was sent, not a check level. `record --verify` proposes those checks from what the demonstration changed. Released. 6. **Stops instead of improvising, and never retries an uncertain save.** A run @@ -538,7 +548,11 @@ A test fails when a command has no file or this list is out of date. - **Fault test.** We injected 8 kinds of bad save, 9 runs each, alongside clean runs: 72 runs left a wrong record behind. A check that trusts the screen's "Saved" banner reported 54 of those as success; reading the record back over the app's REST API missed 9; the - complete database read path caught all 72. The fault set and method are in + complete database read path caught all 72. The test app's database is + SQLite with two record tables, so "every table" there is two tables. + Separately, 9 of the 18 correct saves stopped in every arm: the server + committed the save but its answer timed out, so the write step halted before + any read-back ran. The count is of end-to-end run outcomes. The fault set and method are in [EFFECT_E2E.md](packages/flow/benchmark/effect_e2e/EFFECT_E2E.md). - **OpenEMR referral: agent, screen program and API step.** Median wall time per referral, from a fresh browser through sign-in, the entry and the read-back: @@ -563,7 +577,9 @@ A test fails when a command has no file or this list is out of date. - **openIMIS claims.** On a test copy of openIMIS, the open-source insurance and claims system that runs Nepal's national health insurance scheme, the compiled program entered 149 synthetic claims with no model calls: 148 read - back correct and none were saved wrong: + back correct and none were saved wrong. Each saved claim was read back by + SQL through a read-only database role on the test copy; the 149th stopped + before saving: [SCOREBOARD.md](packages/flow/benchmark/scoreboard/SCOREBOARD.md#openimis). The systems each result ran on are listed in diff --git a/README.md b/README.md index d645a431fd..b74168aa28 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ every run. OpenAdapt lets your agent, or a person, do a task once in a web, Windows, macOS, Linux or remote-desktop app. It compiles that run into a program, and your agent calls the program as one tool. The program runs with no model calls and sends no screenshots anywhere. It confirms the right record before -each save, reads the save back from the system of record after it, and returns -a plain outcome. When anything doesn't match, it stops and tells your agent +each save, checks the save after it, and returns a plain outcome that says +how the save was checked. When anything doesn't match, it stops and tells your agent instead of guessing. ## Measured on OpenEMR and openIMIS @@ -45,7 +45,8 @@ has every run. On a test copy of openIMIS, the open-source insurance and claims system that runs Nepal's national health insurance scheme, the compiled program entered 149 synthetic claims with no model calls: 148 read back correct and none were -saved wrong +saved wrong. Each saved claim was read back by SQL through a read-only +database role on the test copy; the 149th stopped before saving ([SCOREBOARD.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/benchmark/scoreboard/SCOREBOARD.md#openimis)). A screen can't show a save that went wrong behind it. On a test copy of @@ -78,6 +79,16 @@ Each check below was asked whether those 72 bad saves had succeeded: | A read of the record over the app's REST API | 9 of 72 (all writes to a table it didn't read) | | A read of every table in the database | 0 of 72 | +The test app's database is SQLite with two record tables, so "every table" +there is two tables; a real system has many more. Separately, 9 of the 18 +correct saves stopped in every arm: the server committed the save but its +answer timed out, so the write step halted before any read-back ran. Most +deployments give no database access at all. Where the app's own screens are +the only independent read, the check covers at most the target record, read +in a separate session, and the same user's changes in the app's activity log +within a stated window, where the app shows one and the program is set up to +read it. + [EFFECT_E2E.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/benchmark/effect_e2e/EFFECT_E2E.md) has the fault set, the method and the raw results. @@ -328,7 +339,7 @@ the right record is on screen, makes the entry, and reads the record back. | Model calls per run | At least one per step | None on a hit; the agent's calls on a miss | None | None with default settings | | When the screen changes | The model tries to adapt | The agent improvises live | A selector stops matching, or matches the wrong control | The run stops before saving; a fix is proposed and a person approves it | | Right record? | The model judges from the screen | Usually only that the screen looks as recorded | Whatever the developer scripted | Checked before every save | -| Did the save land? | The model judges from the screen | The screen | Whatever the developer scripted | Read back from the system of record | +| Did the save land? | The model judges from the screen | The screen | Whatever the developer scripted | Reported verified only when a read outside the acting session confirms it; weaker checks are named as such | | Strongest for | New or changing tasks | Repeated tasks where a wrong save is cheap | Stable processes with a team to maintain the scripts | The same entry many times, where a wrong save is costly | ## What it can do @@ -337,7 +348,7 @@ the right record is on screen, makes the entry, and reads the record back. - **Uses the most reliable layer the app allows**: page structure (DOM, UI Automation, Accessibility), direct API calls where one is bound, and pixels only for remote desktops. - **Builds branching programs** from several demonstrations, repeated halts and background runs, and routes each item to the right verified variant. - **Works across surfaces**: web, Windows, macOS, Linux and RDP backends, chained in one workflow. -- **Confirms the right record before every write and reads the saved record back** from the system of record, never just the screen. +- **Confirms the right record before every write and checks the saved record after it**. A run is reported verified only when a read outside the acting session confirms the save: the system of record where one can be read, or a separate session. Weaker checks are reported at their own level. - **Stops instead of guessing**, never retries an uncertain save, and says what changed before a stop. - **Binds each approval to exactly what will be saved**, with one-tap answers on a paired phone. - **Repairs itself when the app changes**, probing a fix up to the save and asking a person to approve it (qualified on browser runs and end to end on native macOS). diff --git a/docs/proposed-web-copy.md b/docs/proposed-web-copy.md new file mode 100644 index 0000000000..31ca337af0 --- /dev/null +++ b/docs/proposed-web-copy.md @@ -0,0 +1,87 @@ +# Proposed website copy: check scope without database access + +Status: draft for approval. Nothing here is applied to the website. + +These changes bring the insurance and dental pages in line with the repository +docs ([LIMITS.md](../packages/flow/docs/LIMITS.md#what-the-guarantee-covers-without-database-access), +[THREAT_MODEL.md](../packages/flow/docs/THREAT_MODEL.md#what-layer-1-covers)). +When a portal's own screens are the only independent read (no database, API, +log or export), the strongest check is a separately signed-in session. It +covers the target record as shown at the time of the read, and only where the +portal allows a second session and that read loads the record fresh from the +server. + +File: `data/site/pages/industries.mjs` in `OpenAdaptAI/openadapt-web`, at +commit `53f05758`. Line numbers refer to that commit. + +## Line 145: insurance, who it's for (make conditional) + +Current: + +> It's also for brokers and agencies that key claims or submissions into +> carrier portals. There, the check opens the saved claim again in a fresh +> browser session and compares it field by field with what was entered. That +> check is set up along with the workflow. + +Proposed: + +> It's also for brokers and agencies that key claims or submissions into +> carrier portals. Where the portal allows a second signed-in session, the +> check opens the saved claim there and compares it field by field with what +> was entered. That shows the claim as the portal displayed it at the time of +> the check, not what the carrier does with it later. Where the portal allows +> no second session, a person reviews each save. The check is set up along +> with the workflow. + +The link that follows ("How to stop re-keying claims") stays. + +## Line 160: insurance, carrier-portal card (make conditional) + +Current: + +> Staff key a submission into several carrier portals, and each save is +> checked by opening it again in a fresh browser session. + +Proposed: + +> Staff key a submission into several carrier portals. Where a portal allows +> a second signed-in session, each save is checked by opening it again there. + +## Line 176: insurance, record-check table (make conditional) + +Current row: + +| Your setup | Second read | Result OpenAdapt can give | +| --- | --- | --- | +| Broker entering into a carrier portal | The saved claim, opened again in a fresh browser session | Checked on screen, at the time of the run | + +Proposed row: + +| Your setup | Second read | Result OpenAdapt can give | +| --- | --- | --- | +| Broker entering into a carrier portal | The saved claim, opened again in a separate signed-in session, where the portal allows one and the second read loads the record fresh from the server | Checked in a separate session, as of the time of the check. With no second session, a person reviews | + +## Line 218: dental page description (remove) + +Current: + +> After a demonstration, OpenAdapt looks up coverage in a payer portal and +> carries the answer into your practice system. We measured the look-up on +> openIMIS, an open-source insurance system, with synthetic members. + +The openIMIS result behind this sentence was checked by SQL on a test copy +with database access. A payer portal gives no such access, so the measured +check does not carry over to the setup the sentence describes. + +Proposed: remove this text. The site's registry test +(`tests/siteRegistry.test.js:86`) requires every page to have a description of +240 characters or fewer, so removing it means either replacing it or removing +the page. If the page stays, a replacement that makes no check claim: + +> After a demonstration, OpenAdapt looks up coverage in a payer portal and +> carries the answer into your practice system after a person approves it. We +> qualify the workflow on your own portal first. + +The same claim appears in the page's answer (line 221), workflow steps (line +231) and test section (line 239). If the description goes, those lines need +the same decision. diff --git a/llms-full.txt b/llms-full.txt index ae1ca3e8ca..e1c200b72f 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -27,8 +27,8 @@ every run. OpenAdapt lets your agent, or a person, do a task once in a web, Windows, macOS, Linux or remote-desktop app. It compiles that run into a program, and your agent calls the program as one tool. The program runs with no model calls and sends no screenshots anywhere. It confirms the right record before -each save, reads the save back from the system of record after it, and returns -a plain outcome. When anything doesn't match, it stops and tells your agent +each save, checks the save after it, and returns a plain outcome that says +how the save was checked. When anything doesn't match, it stops and tells your agent instead of guessing. ## Measured on OpenEMR and openIMIS @@ -55,7 +55,8 @@ has every run. On a test copy of openIMIS, the open-source insurance and claims system that runs Nepal's national health insurance scheme, the compiled program entered 149 synthetic claims with no model calls: 148 read back correct and none were -saved wrong +saved wrong. Each saved claim was read back by SQL through a read-only +database role on the test copy; the 149th stopped before saving ([SCOREBOARD.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/benchmark/scoreboard/SCOREBOARD.md#openimis)). A screen can't show a save that went wrong behind it. On a test copy of @@ -88,6 +89,16 @@ Each check below was asked whether those 72 bad saves had succeeded: | A read of the record over the app's REST API | 9 of 72 (all writes to a table it didn't read) | | A read of every table in the database | 0 of 72 | +The test app's database is SQLite with two record tables, so "every table" +there is two tables; a real system has many more. Separately, 9 of the 18 +correct saves stopped in every arm: the server committed the save but its +answer timed out, so the write step halted before any read-back ran. Most +deployments give no database access at all. Where the app's own screens are +the only independent read, the check covers at most the target record, read +in a separate session, and the same user's changes in the app's activity log +within a stated window, where the app shows one and the program is set up to +read it. + [EFFECT_E2E.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/benchmark/effect_e2e/EFFECT_E2E.md) has the fault set, the method and the raw results. @@ -338,7 +349,7 @@ the right record is on screen, makes the entry, and reads the record back. | Model calls per run | At least one per step | None on a hit; the agent's calls on a miss | None | None with default settings | | When the screen changes | The model tries to adapt | The agent improvises live | A selector stops matching, or matches the wrong control | The run stops before saving; a fix is proposed and a person approves it | | Right record? | The model judges from the screen | Usually only that the screen looks as recorded | Whatever the developer scripted | Checked before every save | -| Did the save land? | The model judges from the screen | The screen | Whatever the developer scripted | Read back from the system of record | +| Did the save land? | The model judges from the screen | The screen | Whatever the developer scripted | Reported verified only when a read outside the acting session confirms it; weaker checks are named as such | | Strongest for | New or changing tasks | Repeated tasks where a wrong save is cheap | Stable processes with a team to maintain the scripts | The same entry many times, where a wrong save is costly | ## What it can do @@ -347,7 +358,7 @@ the right record is on screen, makes the entry, and reads the record back. - **Uses the most reliable layer the app allows**: page structure (DOM, UI Automation, Accessibility), direct API calls where one is bound, and pixels only for remote desktops. - **Builds branching programs** from several demonstrations, repeated halts and background runs, and routes each item to the right verified variant. - **Works across surfaces**: web, Windows, macOS, Linux and RDP backends, chained in one workflow. -- **Confirms the right record before every write and reads the saved record back** from the system of record, never just the screen. +- **Confirms the right record before every write and checks the saved record after it**. A run is reported verified only when a read outside the acting session confirms the save: the system of record where one can be read, or a separate session. Weaker checks are reported at their own level. - **Stops instead of guessing**, never retries an uncertain save, and says what changed before a stop. - **Binds each approval to exactly what will be saved**, with one-tap answers on a paired phone. - **Repairs itself when the app changes**, probing a fix up to the save and asking a person to approve it (qualified on browser runs and end to end on native macOS). @@ -517,8 +528,18 @@ monorepo and installable from source. (`compose`, `process`, released), and one program can switch surfaces, tabs and popups mid-run ([#1197](https://github.com/OpenAdaptAI/OpenAdapt/pull/1197)). 5. **Confirms the right record before every write and reads it back after.** - The record check reads the system of record (API, database, FHIR with SMART - Backend Services, or a separate signed-in session), never just the screen. + A run is `VERIFIED` only when a read outside the acting session confirms the + save: the system of record (API, database, FHIR with SMART Backend Services, + a log or an export) or a separate session (a fresh sign-in on the web; on + desktop, a fresh session or a relaunch of the app, as the deployment + declares). A read on the acting screen gets its own level and never + verifies a run. The run report names the level for each save with a + declared read-back. Where the app's own screens are the only independent + read, the check covers at most the target record, plus the same actor's + changes in the app's activity log within a stated window where the app + shows one and the program is set up to read it; other records, later + server-side jobs and outbound messages are not covered. The wire check is + evidence of what was sent, not a check level. `record --verify` proposes those checks from what the demonstration changed. Released. 6. **Stops instead of improvising, and never retries an uncertain save.** A run @@ -998,7 +1019,11 @@ A test fails when a command has no file or this list is out of date. - **Fault test.** We injected 8 kinds of bad save, 9 runs each, alongside clean runs: 72 runs left a wrong record behind. A check that trusts the screen's "Saved" banner reported 54 of those as success; reading the record back over the app's REST API missed 9; the - complete database read path caught all 72. The fault set and method are in + complete database read path caught all 72. The test app's database is + SQLite with two record tables, so "every table" there is two tables. + Separately, 9 of the 18 correct saves stopped in every arm: the server + committed the save but its answer timed out, so the write step halted before + any read-back ran. The count is of end-to-end run outcomes. The fault set and method are in [EFFECT_E2E.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/benchmark/effect_e2e/EFFECT_E2E.md). - **OpenEMR referral: agent, screen program and API step.** Median wall time per referral, from a fresh browser through sign-in, the entry and the read-back: @@ -1023,7 +1048,9 @@ A test fails when a command has no file or this list is out of date. - **openIMIS claims.** On a test copy of openIMIS, the open-source insurance and claims system that runs Nepal's national health insurance scheme, the compiled program entered 149 synthetic claims with no model calls: 148 read - back correct and none were saved wrong: + back correct and none were saved wrong. Each saved claim was read back by + SQL through a read-only database role on the test copy; the 149th stopped + before saving: [SCOREBOARD.md](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/benchmark/scoreboard/SCOREBOARD.md#openimis). The systems each result ran on are listed in @@ -1826,6 +1853,12 @@ What the wire check doesn't see: still held until the page closes, but the run, already over, doesn't report it. +The wire check is evidence about what left the browser. It is not a check +level: a request that matched the declaration says nothing about what the +server stored, so a run is never `VERIFIED` on the wire check alone. Its +scope is the channel it observed (the browser context's routes) and the +request shapes it parsed (form fields and flat JSON). + A page whose own listener changes a field as the form is sent changes what is sent after the check, so its save halts even when the demonstration did the same: a false halt, in the safe direction. The compiler treats a click on the @@ -1994,6 +2027,46 @@ effect path refused. See [`EFFECT_VERIFIER.md`](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/design/EFFECT_VERIFIER.md). This is evidence for the mechanism, not proof that a customer-specific effect binding is correct. +The 72-fault table in the README +([`EFFECT_E2E.md`](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/../benchmark/effect_e2e/EFFECT_E2E.md)) has two limits +of its own. Its database is SQLite with two record tables (encounters and +billing), so "a read of every table" there means two tables; a production +system has hundreds, and a read path rarely covers them all. And 9 of the 18 +correct saves stopped in every arm: the `timeout` case commits the save but +the client never learns it, so the write step halts before any read-back +runs. That is a safe false stop, but it is a false stop, and it counts end-to-end +run outcomes rather than any one check. + +The openIMIS claims result (148 of 149 read back correct) was checked by SQL, +through a read-only database role on a test copy. It shows the program and +the check on a real application with database access; it is not evidence for +a deployment without it. + +#### What the guarantee covers without database access + +Most deployments give no database or API access. Where the application's own +screens are then the only independent read (no readable log or export of +committed data, which can still give level 4; see +[`RECORDS.md`](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/RECORDS.md)), the strongest read is a separate session +(`separate_session`, level 3 in +[`check_level.py`](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/docs/../../types/openadapt_types/check_level.py)), and the +guarantee is narrower: + +- it covers the target record, read back in that session; +- where the application shows an activity or audit log and the program is + set up to read it, it also covers the same actor's logged changes within a + stated window (with no audit view declared, a collateral edit to another + record is not seen); +- it does not cover other records the log doesn't show, server-side jobs that + run after the read, or outbound effects (HL7, message queues, email, a + downstream service). + +`VERIFIED` there means "as of the read-back time, the separate session showed +this value". It is not a claim that the value persisted, or that the run +caused nothing else. The run report names the check level for every save +with a declared read-back. A legacy step with no declared effect is checked +only by its screen postcondition and is not graded on the ladder. + #### On-screen read-back (the no-API default oracle) is a consistency signal, not transactional proof For a GUI-only recording (Citrix / legacy EMR with no reachable read API), the diff --git a/packages/flow/README.md b/packages/flow/README.md index d0274009f1..46867d77be 100644 --- a/packages/flow/README.md +++ b/packages/flow/README.md @@ -460,7 +460,10 @@ browser workflows. Desktop and Citrix runs are self-hosted database, FHIR, a report export or a separate signed-in session. The record check reads whatever that path covers. In a fault test with injected bad writes, a screen-only check passed 54 of the 72 runs that left the record - wrong, one API read passed 9, and a read of every table passed none + wrong, one API read passed 9, and a read of every table passed none. The + test database is SQLite with two record tables. Separately, 9 of the 18 + correct saves stopped in every arm, when the save's answer timed out and + the write step halted before any read-back ran ([`EFFECT_E2E.md`](https://github.com/OpenAdaptAI/OpenAdapt/blob/main/packages/flow/benchmark/effect_e2e/EFFECT_E2E.md)). - On pixel surfaces, the identity check takes extra looks before it stops on a look-alike record ID: false stops on a dense record list fell from 232 to diff --git a/packages/flow/docs/LIMITS.md b/packages/flow/docs/LIMITS.md index a75c5b0da3..f7ace2c441 100644 --- a/packages/flow/docs/LIMITS.md +++ b/packages/flow/docs/LIMITS.md @@ -488,6 +488,12 @@ What the wire check doesn't see: still held until the page closes, but the run, already over, doesn't report it. +The wire check is evidence about what left the browser. It is not a check +level: a request that matched the declaration says nothing about what the +server stored, so a run is never `VERIFIED` on the wire check alone. Its +scope is the channel it observed (the browser context's routes) and the +request shapes it parsed (form fields and flat JSON). + A page whose own listener changes a field as the form is sent changes what is sent after the check, so its save halts even when the demonstration did the same: a false halt, in the safe direction. The compiler treats a click on the @@ -656,6 +662,46 @@ effect path refused. See [`EFFECT_VERIFIER.md`](design/EFFECT_VERIFIER.md). This is evidence for the mechanism, not proof that a customer-specific effect binding is correct. +The 72-fault table in the README +([`EFFECT_E2E.md`](../benchmark/effect_e2e/EFFECT_E2E.md)) has two limits +of its own. Its database is SQLite with two record tables (encounters and +billing), so "a read of every table" there means two tables; a production +system has hundreds, and a read path rarely covers them all. And 9 of the 18 +correct saves stopped in every arm: the `timeout` case commits the save but +the client never learns it, so the write step halts before any read-back +runs. That is a safe false stop, but it is a false stop, and it counts end-to-end +run outcomes rather than any one check. + +The openIMIS claims result (148 of 149 read back correct) was checked by SQL, +through a read-only database role on a test copy. It shows the program and +the check on a real application with database access; it is not evidence for +a deployment without it. + +#### What the guarantee covers without database access + +Most deployments give no database or API access. Where the application's own +screens are then the only independent read (no readable log or export of +committed data, which can still give level 4; see +[`RECORDS.md`](RECORDS.md)), the strongest read is a separate session +(`separate_session`, level 3 in +[`check_level.py`](../../types/openadapt_types/check_level.py)), and the +guarantee is narrower: + +- it covers the target record, read back in that session; +- where the application shows an activity or audit log and the program is + set up to read it, it also covers the same actor's logged changes within a + stated window (with no audit view declared, a collateral edit to another + record is not seen); +- it does not cover other records the log doesn't show, server-side jobs that + run after the read, or outbound effects (HL7, message queues, email, a + downstream service). + +`VERIFIED` there means "as of the read-back time, the separate session showed +this value". It is not a claim that the value persisted, or that the run +caused nothing else. The run report names the check level for every save +with a declared read-back. A legacy step with no declared effect is checked +only by its screen postcondition and is not graded on the ladder. + #### On-screen read-back (the no-API default oracle) is a consistency signal, not transactional proof For a GUI-only recording (Citrix / legacy EMR with no reachable read API), the diff --git a/packages/flow/docs/THREAT_MODEL.md b/packages/flow/docs/THREAT_MODEL.md index 704478dfec..7112d5857e 100644 --- a/packages/flow/docs/THREAT_MODEL.md +++ b/packages/flow/docs/THREAT_MODEL.md @@ -2,7 +2,8 @@ OpenAdapt lets an agent do a task once and compiles that run into a program that makes no model calls. Before each save the program checks that the right -record is open; after the save it reads the system of record back. This page +record is open; after the save it reads the record back through the strongest +path the deployment provides, and the run's report names how it was checked. This page covers what can go wrong when the content an agent reads is hostile, which controls stop it, and what is still not protected. @@ -12,7 +13,8 @@ something else? Published work on computer-use agents (OS-Harm, RedTeamCUA, VPI-Bench) shows that instructions rendered on screen steer current agents often. OpenAdapt does not try to make the agent resist those instructions. It limits what the agent's actions can do, using values declared before the -agent reads any page, and it checks the result in the system of record. This +agent reads any page, and it checks the result through a read the agent +cannot write. This follows the design in "Defeating Prompt Injections by Design" (CaMeL): the declared task is the control flow, and page text is data that can never widen it. @@ -26,24 +28,55 @@ checks only reduce how often that owner has to act. | Layer | Guarantees | Where it applies | | --- | --- | --- | -| **1. The record check** | A write is reported as saved only if the system of record shows exactly the declared effect and nothing else the run caused. Anything else is a stop. | Every surface: browser, desktop, Citrix and RDP | +| **1. The record check** | A write is reported as `VERIFIED` only if a read independent of the acting session showed the declared effect at the time of the read, within what that read covers (below). Anything else is a stop or a weaker outcome. | Every surface: browser, desktop, Citrix and RDP. What it covers depends on the read path | | **2. The wire check** | Only declared writes leave: the method, the path and the body must match before the request is sent. Anything else is refused. | Wherever requests can be intercepted, the browser today | | **3. Undo or a person** | A wrong write the record check catches is undone and the undo verified, or it goes to a person with the exact difference. A write that cannot be undone needs a person's approval first. | Every surface | +### What layer 1 covers + +Layer 1 can only report what its read path shows. The run's report names +the check level ([`check_level.py`](../../types/openadapt_types/check_level.py), +[READBACK_LADDER.md](READBACK_LADDER.md)) for every save with a declared +read-back; a legacy step with no declared effect is checked only by its +screen postcondition and is not graded. + +- **With a system-of-record read** (API, FHIR, SQL, a log or an export, level + 4), the check covers the target record and whatever else that read path + reads. A collateral write outside the read path is not seen. +- **When the application's own screens are the only independent read** (no + database, API, readable log or export; most deployments give no database + access), the check covers the target record and, where the application + shows an activity or audit log and the program is set up to read it, the + same actor's logged changes within a stated window. A separate session + (level 3) is the strongest read available there. Changes to other records that the log does + not show, server-side jobs that run later, and outbound messages (HL7, + queues, email) are outside it. +- **Reads in the acting session** (`same_screen`, `reopened`) are reported at + their own levels and never make a run `VERIFIED`. + +`VERIFIED` means "as of the read-back time, the read showed this value". It +does not mean the value persisted after that, and it does not mean the run +caused nothing else. Server-side asynchronous effects and outbound effects +are not observed. + +The wire check (layer 2) is evidence about what was sent. It is not a check +level and does not by itself make a run `VERIFIED`. + Everything else, including the identity checks before a click, look-alike row counting, focus and form checks and pixel grounding, is a **pre-check**. A pre-check avoids bad writes and wasted runs. It must fail closed when unsure, but it is never the thing that makes a run safe: if a pre-check is -fooled, layer 1 catches the result and layer 3 handles it. +fooled, layer 1 catches a result that its read path covers and layer 3 +handles it. What each attacker can do, and which layer stops it: | Threat | Owner | | --- | --- | | The app changed: a new layout, a renamed button, look-alike rows | Pre-checks stop most cases; layer 1 catches the rest | -| The agent is wrong, hijacked or tries to cheat | Layer 2 refuses undeclared writes; layer 1 checks the outcome through a channel the agent cannot write | +| The agent is wrong, hijacked or tries to cheat | Layer 2 refuses undeclared writes where requests can be intercepted (a state-changing GET that it classes as a read is not refused; see LIMITS.md); layer 1 checks the outcome through a read the agent cannot write, within that read's coverage | | The app's own page scripts change what is sent | Layer 2 compares what is actually sent; layer 1 checks what was stored | -| The app's server says "saved" and writes nothing, or writes elsewhere | Layer 1 reads the store directly | +| The app's server says "saved" and writes nothing, or writes elsewhere | Layer 1 reads the target record from outside the acting session. A write elsewhere is caught only if the read path covers it (a database or API read of that table, or the app's activity log when the program is set up to read it) | | A bug in OpenAdapt | Layer 1, and blind fault suites that measure it | **Rule for reviews.** A finding that a pre-check can be fooled is a