Scope safety
The model uses a closed seven-scope catalog, denies unknown scopes and inactive clients, contains grants within the registered client allowlist, and excludes direct-write scopes in enforce mode.
ProvidEHR is pursuing a rigorous, reproducible evidence standard for a population-prevention operating system and extensible longitudinal EHR foundation. Selected security-critical decisions are modeled in Lean 4; red-team and deterministic national-scale harnesses turn security and capacity claims into reviewable campaigns. This page distinguishes implemented harnesses from production-equivalent execution, independent review, and certification.
17/17 claims map to checked Lean theorems. Tenant-model governance promotion still requires independent review; Rust refinement and production evidence remain 0/17.
These labels are intentionally not interchangeable.
Thirty-one Lean theorem declarations cover the versioned SMART 1.0 model and the ninth formal protocol family for tenant/deployment-cell isolation. Every number below links model proof, independent checking, executable evidence, and known gaps without turning any one layer into a claim about the whole EHR.
The current package contains checked Lean proofs for deliberately bounded SMART authorization and refresh decisions plus structural tenant/cell key and read isolation. It connects the SMART model to executable Rust evidence without relabeling conformance tests as refinement proof; the new runtime scope tests are still not a Lean-to-Rust refinement proof.
Evidence history: The original 22-theorem SMART snapshot remains intact. This release adds nine tenant and deployment-cell isolation theorems as protocol.tenant-isolation.v1, formal protocol family 09. Its two coverage claims map to kernel- and nanoda-checked Lean theorem terms, while formal-inventory model promotion remains withheld pending independent review. Rust property, differential, integration, refinement, and production evidence remain unpromoted. The combined 17-claim ladder preserves the historical SMART mapping without borrowing runtime credit for the new model.
Lean 4.31.0 · Rust 1.97.0 · pinned lean4export 3de59f10 · pinned nanoda 6524aed3 · allowlist: propext, Classical.choice, Quot.sound · sorryAx and compiler-trust primitives rejected
Typed SMART decisions and structural tenant/cell storage decisions define a 31-theorem claim boundary.
Lean 4.31.0 accepts the proof terms; separate release checks reject escape hatches.
Pinned lean4export targets every theorem and fails if inventory drifts.
Pinned nanoda accepts the 774-declaration closure and rejects sorryAx/compiler trust.
Lean emits 24 complete versioned inputs, outputs, grants, and state projections.
Property tables include 131,072 closed-scope combinations plus patient and refresh checks.
Named adapter regressions cover 10 of 17 claims; five SMART and two tenant-model gaps stay visible.
Rust refinement and production evidence remain 0 of 17; the tenant model does not change those zeroes by inference.
The model uses a closed seven-scope catalog, denies unknown scopes and inactive clients, contains grants within the registered client allowlist, and excludes direct-write scopes in enforce mode.
Modeled Observation reads require the exact scope and patient binding. Sandbox writes require the matching patient and write scope; enforce mode denies every direct SMART write.
Modeled refresh rotation requires the correct client and a fresh successor, consumes the presented token, rejects sequential replay, and preserves client, patient, and scopes.
The abstract storage model makes tenant and cell part of authoritative key identity. Different tenants or cells cannot alias, and reads with either coordinate mismatched return no value.
Helper lemmas are counted, named, exported, and independently checked—never folded into a vague “verified” badge.
Exact nonempty grants, active clients, closed scopes, allowlist containment, supported posture, and enforce-mode exclusion of direct-write scopes.
Enforce mode always denies direct SMART writes; a sandbox permit requires a direct-write scope and exact patient binding.
Modeled Observation reads require Observation.read and exact token-to-resource patient equality; explicit mismatch is denied.
Correct-client rotation to a fresh successor consumes the presented token, preserves bindings, leaves denial state unchanged, and rejects replay.
Tenant and deployment-cell coordinates are part of authoritative key identity; differing scopes cannot alias, exact-scope reads preserve the selected value, and cross-tenant or cross-cell reads deny.
All 15 SMART and 2 tenant-isolation claims name checked theorems; tenant governance promotion awaits independent review.
All SMART claims are covered; both tenant-model claims remain unpromoted.
One SMART replay trace and both tenant-model claims remain outside versioned cross-language fixtures.
No theorem connects the production Rust implementation to the Lean functions.
Five SMART adapter contracts and both tenant-model claims retain explicit gaps.
Model evidence is not represented as deployed operational evidence.
theorem enforce_grants_have_no_direct_write {client : Client}
{request : AuthorizationRequest} {grant : Grant}
(hauthorize : authorize .enforce client request = some grant)
(scope : Scope) (hgranted : grant.scopes scope = true) :
isDirectWrite scope = false := by
have hsupported := successful_grant_uses_only_supported_scopes
hauthorize scope hgranted
cases scope <;> simp_all [isSupported, isDirectWrite]Pinned toolchains, exact inventories, complete-case comparison, and source-drift checks are repository-owned gates.
$ (cd formal/lean && lake build ProvidEHRFormal && lake env leanchecker ProvidEHRFormal.Smart && lake env leanchecker ProvidEHRFormal.TenantIsolation)
$ scripts/verify-formal-nanoda.sh
$ cargo test -p protocol-kernel --locked
$ scripts/verify-formal-vectors.sh
$ scripts/verify-formal-coverage.shVersioned openEHR-compatible compositions remain the authoritative ProvidEHR record. FHIR, IPS, registry, OMOP, MCP, A2A, analytics, and UI views are controlled projections or workflow surfaces—not parallel clinical databases.
On migrated high-risk mutation paths, verified identity, tenant, role and patient scope, purpose and consent context, capability, and approval evidence are evaluated before effect. Coverage remains path-specific until one adjudicator governs every REST, FHIR, export, MCP, A2A, and integration path. Agent output must not become authoritative merely because a model produced it.
Codex, Claude Code, Claude Cowork, MCP, and A2A receive typed capabilities and short-lived delegated context. They do not receive raw database access or an unrestricted FHIR write primitive.
Implemented, exercised, sandbox, planned, and not-claimed states stay distinct. A Lean theorem proves its model; it does not silently become a claim about all Rust, infrastructure, clinical outcomes, or certification.
ProvidEHR now versions the methods needed to test hostile behavior and an exact 10,000,000-patient, 20-cell engineering target. Implementing a harness is the beginning of evidence: production-equivalent execution, failure and restore phases, and independent review are separate promotion gates.
Make control failure reproducible before an attacker makes it consequential.
Engineer toward 10,000,000 patients—and make the word validated expensive.
Each visual is generated client-side from a static repository definition. The server-rendered text version is the accessible source of truth and survives disabled JavaScript or renderer failure.
COSMIC remains the incumbent EHR; ProvidEHR adds prevention workflows and a governed record; InVivo closes the between-visit patient loop.
Visual loads as this section approaches the viewport
Boundary: The diagram expresses component responsibility. It does not claim that every Swedish national connector or COSMIC sandbox workflow is live.
Browsers and agents terminate at controlled APIs. Only Rust services access the clinical store; integration credentials are mounted into isolated workers.
Visual loads as this section approaches the viewport
Boundary: Runtime scope is explicit, but complete SurrealDB row/query isolation and deployed credential cutover are not yet claimed. The locally exercised evidence environment is single-node; clustered failover, regional cells, and durable distributed delegation remain target-state work.
The implemented standalone launch uses registered clients, exact redirect and scope allowlists, PKCE, patient binding, and enforce-mode read-only posture.
Visual loads as this section approaches the viewport
Boundary: Codes, pending requests, and refresh families are currently process-local. EHR/workforce launch, durable revocation, and sender-constrained tokens remain planned.
Implemented staging and promotion controls show the intended common write boundary for UI, FHIR, MCP, A2A, and integrations.
Visual loads as this section approaches the viewport
Boundary: Staging and promotion are implemented, but not every REST, FHIR, MCP, A2A, or integration mutation has yet been migrated behind one durable adjudicator.
One repository plugin packages shared healthspan skills while each host receives an explicit, least-privilege connection profile.
Visual loads as this section approaches the viewport
Boundary: The plugin is installable; customer identity issuance, enterprise installation policy, durable delegation, and hosted OAuth remain production gates.
Repository evidence includes a deterministic local export/import/restart rehearsal. Multi-node and regional disaster recovery are deliberately shown as unproven next steps.
Visual loads as this section approaches the viewport
Boundary: A single-node restore rehearsal is not high availability, an agreed RPO/RTO, or regional disaster-recovery evidence.
A versioned attack catalog drives bounded runners, security tools, mutation checks, retained reproducers, and release decisions without treating a scanner invocation as a penetration test.
Visual loads as this section approaches the viewport
Boundary: The catalog, verifier, bounded runner, and mutation tests are implemented. A complete release and scheduled campaign, retained external-tool evidence, and an independent penetration test remain required before claiming penetration resistance.
The target acceptance design covers 10,000,000 deterministic synthetic patients across 20 isolated deployment cells, with load, failure, restore, and integrity phases producing one reconciled evidence report.
Visual loads as this section approaches the viewport
Boundary: Profiles, deterministic generation and reconciliation, execution guardrails, and a local workload exercise are implemented. Full 20-cell fan-out, distributed generation, soak, dependency failure, restart/restore, N+1/failover tooling and execution, plus an independent benchmark, remain open acceptance gates.
The matrix is release diligence, not a feature checklist. Every positive statement carries a boundary that prevents a broader reading.
| Area | Maturity | Current evidence | Explicit boundary |
|---|---|---|---|
| React clinician and marketing applications | Exercised | TanStack Start client and SSR builds, typed API clients, Vitest suites, and deployed HTTPS frontend. | The browser is not a clinical database and keeps patient context out of persistent browser storage. |
| Rust clinical API | Exercised | Axum services, focused authority and workflow tests, locked dependency builds, and broad local API test execution in the current evidence cycle. | The backend code is implemented and exercised locally; a passing suite is not production deployment, penetration resistance, clinical certification, or population-scale capacity evidence. |
| Versioned clinical store | Exercised | Persistent SurrealDB/RocksDB, version history, compositions, state transitions, and isolated export/import/restart rehearsal. | SurrealDB 3.2.1 is pinned for the evidence environment. Production backend topology, managed storage, HA, DR, and cutover are not yet evidenced. |
| Tenant and cell runtime scope | Implemented | Strict TenantId, CellId and DataScope values are mandatory at store construction; readiness, SMART configuration, audit evidence and in-memory durable-state keys preserve the same scope, with adversarial cross-scope tests. | These tests are not promoted as formal Rust-property or refinement evidence. This runtime and in-memory foundation is not yet complete SurrealDB row/query isolation, proof that every application query is tenant-safe, or deployed multi-tenant evidence. |
| Runtime database authority and schema maintenance | Exercised | The API and worker use a record-authenticated runtime principal bound to an explicit authority generation; stale identities and owner-style runtime credentials fail closed. A separate maintenance controller and image owns schema preparation, provisioning, verification, and runtime-authority verification. | The authority split is implemented and locally exercised. Production secret/KMS integration, deployed cutover, container-platform policy, transport controls, and independent operational evidence remain release gates. |
| openEHR, AQL, FHIR, IPS, and OMOP projections | Implemented | Canonical compositions plus controlled clinical, interoperability, registry, and analytics projections in Rust. | Broad standard support is not the same as external certification or complete conformance-suite evidence. |
| SMART App Launch | Exercised | Registered clients, exact redirects/scopes, PKCE, signed patient-bound tokens, rotating refresh, and 30 focused regressions. | Standalone patient launch only; enforce mode is read-only and durable refresh-family persistence is not complete. |
| Cambio COSMIC adapter | Sandbox | Tenant-bound connection contracts, inbound/outbound state, reconciliation, idempotent NEWS2 write-back, and fail-closed tests. | Credentialed Cambio sandbox evidence and closure of current security gates are still required before activation. |
| Codex and Claude Co-work plugin | Implemented | Repository marketplace manifests, host-specific MCP configuration, shared skills, validation tests, and documented install flows. | Hosted Codex Work/ChatGPT has no bundled OAuth/app connector for PHI; token issuance remains manual and short-lived. |
| MCP and A2A capability surfaces | Implemented | Public non-PHI discovery, delegated clinical reads, typed tools/resources/prompts, A2A task execution, audit, and bounded registries. | Durable A2A lifecycle, unified write approval, and broad agent write-back remain planned. |
| Lean protocol verification | Exercised | Lean 4.31.0 checks 31 theorems across the bounded SMART and tenant/cell-isolation models; nanoda independently checks 774 declarations; 24 complete SMART cases exercise safe Rust. | The new isolation theorems prove the abstract scoped-key/read model. Production Rust is not refinement-proved equivalent, SurrealDB behavior is outside that model, and deployed operations are not proved. |
| Red-team assurance suite | Implemented | A versioned attack catalog, bounded no-shell runner, exact-source verification, evidence-hygiene checks, attack profiles, and mutation tests make adversarial regressions reproducible. | A complete isolated release/scheduled campaign, retained fuzz and DAST evidence, remediation review, and an independent penetration test have not yet been completed. |
| 10M / 20-cell national-scale harness | Implemented | An exact 10,000,000-patient profile spans 20 isolated cells. Deterministic de-identified constant-memory corpus and reconciliation tools, guarded workload execution, profile verification, and a small local synthetic exercise are versioned. | This is harness evidence—not a production-equivalent 10M result. The full run, soak/failure/restore campaign, HA/DR evidence, and independent benchmark remain unexecuted. |
| Regulated PHI production and medical-product classification | Not claimed | A concrete target-state and release-gate backlog exists for IAM, tenant isolation, audit, DR, safety, quality, and regulatory evidence. | ProvidEHR is not currently represented as certified, classified, highly available, or ready for unqualified regulated-PHI operation. |
ProvidEHR has real application controls and real gaps. Medical-product readiness requires both the implemented control plane and independently reviewable operational, safety, and quality evidence.
Generic OIDC/SAML federation, immutable issuer-subject accounts, SITHS/HSA assignments, session revocation, and key rotation evidence.
One central policy decision and obligation engine enforced by every REST, FHIR, export, MCP, A2A, and integration path.
Complete application-query isolation coverage, migrate remaining protected persistence and identifier indexes to managed envelopes and keyed lookup, deploy Vault Transit and runtime authority in a production-equivalent cell, add signed national-identity proofing, wire live vendor credentials and complete external clinician-key lifecycle evidence, build durable resumable rewrap and dual-index MAC rotation with rollback and revocation, add connector public-key rollover and signing rotation, ingest live provider audit exports with alert delivery and operational reconciliation, publish checkpoints to externally custodied WORM storage and SIEM, independently verify managed runtime evidence, and add retention and legal hold.
Production-equivalent 10M execution, soak/failure/restore, capacity SLOs, multi-node failover, encrypted offsite backups, agreed RPO/RTO, regional recovery, observability, independent benchmark and pen test, DPIA, safety case, QMS, and certification evidence.
The current protocol portfolio supports a useful clinical slice. External certification, customer activation, national agreements, and full profile coverage remain separate evidence obligations.
Canonical record, templates, compositions, versions, and controlled query
Boundary: Compatibility is implemented; formal vendor conformance certification is not claimed.
Clinical façade, patient-bound SMART access, documents, and interoperability projections
Boundary: Not every resource, interaction, or national profile is complete.
Standalone patient authorization with PKCE and registered-client scope ceilings
Boundary: No EHR/workforce launch; enforce-mode direct clinical writes are denied.
Permissioned agent tools, resources, prompts, and source-cited clinical reads
Boundary: Delegation issuance is short-lived; durable OAuth and broad governed writes remain incomplete.
Agent discovery, bounded skill execution, tasks, and artifacts
Boundary: Task state is process-local and not yet a durable enterprise collaboration fabric.
Tenant-bound patient matching, inbound sync, outbound delivery, reconciliation, and governed write-back
Boundary: Live credentialed sandbox validation remains an activation gate.
1177/Journalen, NPÖ/HIE, SITHS/HSA, national terminology, quality registries, and EHDS alignment
Boundary: Strategy-aligned architecture and adapter plan; no blanket live-integration claim.
Target enterprise connector and exchange portfolio
Boundary: Roadmap scope, not current production capability.
The same repository plugin serves Codex, Claude Code, and Claude Cowork. Host-specific authentication and tool exposure remain explicit so convenience never silently widens clinical authority.
Issue delegation out of band and expose it only to the process that launches Codex.
$ codex plugin marketplace add advatar/ProvidEHR --ref main --sparse .agents/plugins --sparse plugins/providehr-healthspan
$ codex plugin add providehr-healthspan@providehr
$ codex plugin listEnable the intentionally disabled-by-default plugin, then supply a short-lived sensitive option.
$ claude plugin marketplace add advatar/ProvidEHR --sparse .claude-plugin plugins/providehr-healthspan
$ claude plugin install providehr-healthspan@providehr --scope user
$ claude plugin enable providehr-healthspan@providehrThe scale-out plan closes concrete availability, tenancy, security, observability, and assurance gaps. It is not used to relabel the locally exercised single-node evidence environment as a deployment.
Restore, restart, reconcile, retain evidence; automate and add regional failover next.
Structured audit exists; distributed traces, capacity SLOs, and on-call evidence remain target state.
Toolchains, actions, and clinical images are pinned; expand SBOM, signing, provenance, and policy enforcement.
Separation of duties exists in bounded paths; complete tenant administration, safety, privacy, and QMS operations next.
Architecture diligence should end in versioned source, tests, ADRs, and release evidence—not an untraceable diagram deck.
Theorem inventory, trusted base, assumptions, exclusions, and proof-to-code rule.
System responsibilities, interfaces, trust zones, data model, and phased target state.
Work packages for charting, IAM, MPI, orders, medication, exchange, agents, DR, and certification readiness.
Codex and Claude installation, authentication boundaries, validation, and safe operating rules.
Versioned decisions for the canonical record, Rust-only store access, and governed agent capabilities.
Complementary COSMIC, ProvidEHR, InVivo, and co-work responsibilities with explicit activation gates.
Versioned attack catalog, bounded execution, mutation gates, evidence hygiene, retained reproducers, and independent-review boundary.
Exact 10M/20-cell profile, deterministic corpus and reconciliation, workload phases, evidence manifest, and unexecuted production-equivalent gates.
See the clinical workspace and prevention loop, or bring a security, architecture, interoperability, or clinical-safety diligence agenda to a working session.