HATS DraftHIPAA Authenticated Transfer Space Specification

Repository

A pnpm workspace. The three modes are sibling apps over a shared core, and the demo and the infrastructure sit alongside them, each built and deployed on its own.

1.1 Layout

1.2 Commands

  • pnpm install
  • pnpm check — type-checks every package, validates the lexicons, and checks links in the repo's Markdown
  • pnpm test — runs every package's unit tests (Testing)
  • pnpm build — renders the site. It fails on a broken internal link, a landing-page link to a missing anchor, or a doc under docs/ missing from the README's index
  • pnpm --filter @hats/site check:citations — fetches every regulation a footnote cites from eCFR or govinfo, and fails if a note's heading or quote doesn't match the source. Run it after changing a citation; tsx docs/site/citations.ts note <citation> drafts a note from the source

Architecture

HATS is a standalone app, not something embedded inside an EHR. It runs as a server instance, or for a patient as a phone web app, and other software talks to it through standard APIs. Embedding ties HATS to each EHR vendor's launch quirks; a standalone app makes the EHR just another client.

The models are Tailscale (one daemon everywhere, a local API, a coordination server you can self-host) and Nextcloud / Immich (a self-hostable server that apps reach through its API).

2.1 One app, three modes

One repository holds all three as sibling directories over a shared core; each is built and deployed on its own.

Tailscale needs a coordination server to tell each side how to reach the other. HATS doesn't, because the policy is the same module in every app, versioned with the spec (Why a coordinator), and coord.hats.health points to it. A coordinator facilitating exchange between institutions stays a role an institution can run (HATS.institution).

2.2 API

Every surface is an existing standard, so anything that already speaks healthcare integrates without learning HATS.

The EHR integrates as a client of the institution node — the same way for Epic, Cerner, or anything homegrown. The institution node holds the space credentials; the EHR never does.

2.3 Asking for access

Every access is a request, never a demand, and the answer is the patient's. What may be asked for, by whom, for what reason, and what a yes looks like all come from the published policy, a module every app imports, so the menu is identical for every patient and knows nothing about any patient's records, including whether any exist.

Nothing sits between the asker and the patient:

  • Every patient has the same spaces. The full set is created empty at account creation (Lexicon Namespaces), so existence is constant and carries no information
  • The request and the answer are each side's own record, in the patient's spaces
  • The patient's managing app decides each pass from what the patient said. Nobody writes into the patient's repo — every account writes only to its own
  • The policy holds no key and keeps nothing: it's data and code every app runs the same way, and whoever acts records it themselves, in the patient's ledger
  • A patient's records are their only records: every yes lives there, and is revocable there

The patient's managing app

Every patient space, the ledger and inbox included, is a managedspace naming the patient's managing app (Upstream): plain, deterministic software that runs the patient's rules, which the patient chooses and anyone can build. HATS ships a reference one. It isn't the coordinator: it acts for one patient, as the patient.

  • At each pass, the patient's host asks it checkUserAccess with the space, the user, read or write, and on reads the attested client. It answers from the patient's records: their yes records, the asker's current role, whether a stay has ended, and for an emergency the clinician's recorded claim. It lets anyone write to the ledger and inbox, and lets the patient and their delegates in force read them. It keeps no access state
  • Record spaces at n and r open to a user under a yes covering that section and level. The v and 42cfrpart2 spaces open to the patient alone, until their own handling comes later
  • Its session is narrow: it reads only the patient's ledger, and writes its own records there. It never reads clinical content, since it never needs it to decide
  • It records each pass it approves before approving it, naming the user, the space, and the client, and says no if that write fails. A pass works for its lifetime, and an institution's node may serve many of its people on one, so who viewed what inside an institution is that institution's own log
  • When it's unreachable, the host says no. Routine reads wait, and an emergency fails closed

Note

The demo runs no managing app. It enforces each yes with member lists, which spaces already have: record spaces are memberspaces, a yes puts the asker on the lists it covers, and a revocation takes them off. A role's end reaches the lists when something acts on it, and the demo's gate stands in for the managing app at break-glass (The Demo)

The patient's own apps see everything through their PDS.

Who's asking. A clinician asks with their role: the PractitionerRole their institution publishes in its own repo, keyed by their DID (People). A role counts only at an institution the published policy accredits, while it's active and inside its period; a yes to someone at an institution it doesn't accredit opens nothing, and the patient's approval sheet says so. The managing app reads the current role at each pass, so a yes is void once the role it names has ended or changed, with no one revoking it. W3C credentials and status lists, for checking a role without reading the institution's repo, come later.

What the asker keeps is theirs. Anything they read, they may keep, under their own legal duties. The yes governs freshness, not storage: once it's void or revoked, updates stop.

A no is best effort for a few minutes. It refuses every new pass at once, but a pass already issued is checked by the servers holding records, not by the managing app, so it reads until it expires, 10 minutes by default. The protocol defines notifyCredentialRevoked for cutting one short, but the reference PDS never sends it.

2.4 Why a coordinator

Someone has to say what may be asked for, by whom, and why, and what a yes looks like, the same for every patient on any host. That's the published policy, versioned with the lexicons and these docs, and that is the coordinator: a spec, not a service. Every app imports the same policy module and works out the same menu, so nothing has to run between an asker and a patient, and nothing shared can be down in an emergency.

The policy is deterministic code, not an organization: given the same version and the same question, every app gets the same menu. It stores no records, knows nothing about them, and decides nothing about any patient.

2.5 Trusting coordinators

Nothing technical makes a wrong menu impossible — no more than today's EHRs can't be misconfigured. HATS makes one unlikely, visible, recomputable, and someone's legal liability:

State law varies, so policy versions are per jurisdiction. Applying the wrong one is a detectable mismatch, and the operator's liability.

2.6 Storage

  • Records carry FHIR resources inside atproto records
  • FHIR R4 (4.0.1) is the canonical version, matching IPS 2.0.1 and US Core. The next migration target is R6 (due late 2026, with a normative core); R5 is skipped
  • Every record names its author and custodian in FHIR Provenance (see Regulatory Model)
  • Decimals are strings. The atproto data model disallows floats, and FHIR treats decimal precision as significant (7.250 is not 7.25). A string preserves both
  • Encrypted at rest on every node, under a key the node's operator holds. That protects a lost or stolen disk; the node still decrypts to serve, so its operator can read what it holds. Personal mode stores no records, and the patient's keys, which sign and never decrypt, stay on the card or in a passkey. What that does and doesn't protect is in Data Security

2.7 Offline operation

A node operates indefinitely without a connection. This is the origin problem: hospitals go fully analog during cyberattacks because their systems are cloud-only. An institution node keeps serving its LAN from its local copy no matter how long it is cut off.

  • Reads come from the local copy. Space credentials are only needed to pull from other hosts, not to serve what a node already holds
  • Writes go to the node's own repo and queue for upstream; repo hosts already retry write notifications on transient failures
  • Accountability fills the gap. Every local read is logged against the reader and reconciled on reconnect (below)

2.8 Sync and reconciliation

Most of the merge problem never arises, because of two properties already in place:

  • Single-writer repos — every account writes only to its own space repo, so two parties never write the same record
  • Additive amendments — an amendment is a new record (Record Integrity), so nothing is overwritten

Together, reconciling two copies is a set union — a grow-only set, the simplest conflict-free replicated data type. The upstream sync path already does this: compare LtHash digests, list the difference, fetch what's missing.

No HATS flow deletes a record, with one necessary exception: restricting a record moves it from n to r, best effort, since copies already shared can't be recalled. The only other removal is of copies, as the law allows (Regulatory Model). A person can still delete what's theirs, a record, a space, or a whole PDS, and no protocol could stop them; what others wrote and the copies they hold stay with them. Both travel as ordinary delete operations, and both are recorded in the audit log.

Two cases need rules:

The amendment chain is a Merkle DAG — the same structure as git history and IPFS. History is recomputable from the records alone.

2.9 LAN peer fetch

Ideas taken from IPFS, without the public network:

  • Content addressing — atproto CIDs are a blessed subset of the IPFS CID format, and DRISL is the successor to DAG-CBOR. A record or blob verifies against its CID and attestation signatures wherever it came from, so the source doesn't matter
  • Local discovery — nodes on the same LAN find each other via mDNS (as kubo does) and fetch from whichever peer has the data. Institution nodes in one hospital serve each other while the internet is down.
  • Large blobs — imaging is content-addressed and fetched from the nearest node, which answers much of the DICOM question in Open Questions

What not to take:

  • The public DHT — it announces who holds which CID, a metadata leak for health data. If HATS uses libp2p, it is a private swarm with a shared key. Kubo describes its private networks as "stable but not quite ready for prime-time"
  • Content addressing as access control — it isn't. Data in the swarm is encrypted, and a peer only serves what the requester is authorized for

2.10 Deployment

Each deployable is chosen against its needs, written down first, so a host can be swapped later by checking the same list.

Coordinator — the spec

Nothing to run: the coordinator is the published policy, the lexicons, and these docs, released together and tagged, as spec-2026-11-11 (CHANGELOG). coord.hats.health redirects here.

Institution node — hospital infrastructure

Workers can't meet the first need, which is the whole point of this deployable.

It syncs only while granted. A node has no credential of its own: it syncs a patient's space on a person's grant. When none of those people has a live session, sync pauses; when the last grant ends, it stops. There's no institutional grant to keep it running. The copy it already holds stays, as the institution's own record (Data Security). Upstream's planned Jetstream for spaces borrows access the same way, and covers most of a node's sync, so that part waits for its example (Upstream).

The demo's node is a Worker all the same: it serves only role changes, which need the internet anyway (The institution node).

Personal — the patient's device

2.11 Open Questions

  • Offline clocks — "reads after the revocation" depends on an offline node's clock. How much drift is tolerated, and what is trusted for ordering?
  • Peer authorization while offline — inside one institution, nodes share its authorization. Should peers from different institutions ever serve each other offline?
  • Push for PWA-only patients — the native app gets APNs or FCM. A patient using only the PWA gets Web Push, which on iOS reaches only a PWA added to the Home Screen and is best-effort everywhere. Is that reliable enough for break-glass notifications?
  • Local socket auth — which local apps may connect, and how they prove it
  • SSE — offer it as a custom Subscriptions channel, or websocket only?
  • Accreditation — who accredits institutions and managing apps. The model is TEFCA's: a designating body (The Sequoia Project, for TEFCA) and a common agreement. Join TEFCA, or run a HATS framework on the same model?
  • Policy as data — the format for published policy. FHIR R5 Permission is the obvious candidate, but it is draft / trial use; a HATS-published lexicon is the fallback

2.12 Notes

  1. 45 CFR 160.402, Basis for a civil money penalty: “General rule. Subject to § 160.410, the Secretary will impose a civil money penalty upon a covered entity or business associate if the Secretary determines that the covered entity or…”

Lexicon Namespaces

HATS.user lexicon. Every patient record lives in a space typed by its IPS section, keyed by its HL7 confidentiality code, and stored as a FHIR resource. Nothing here is a HATS vocabulary; the lexicon only arranges existing standards into atproto spaces.

Institutional namespaces (health.hats.institution.*, including .pneumatic) are defined in the HATS.institution subspace, not here.

Authority: hats.health. Every HATS NSID sits under health.hats.*. Schemas are published by one DNS TXT record per authority, each did=<publishing DID>: _lexicon.hats.health, _lexicon.records.hats.health, _lexicon.fhir.hats.health, _lexicon.audit.hats.health, _lexicon.provider.hats.health, _lexicon.institution.hats.health, _lexicon.pneumatic.institution.hats.health. The publisher is the project account, @hats.health, whose public repo holds each schema as a com.atproto.lexicon.schema record keyed by NSID. Its PDS runs pds.js on Cloudflare Workers. Every schema is published, space types included (how). The schemas themselves are in lexicons/.

3.1 Shape

A record's address puts all of it together:

  • Read access is per space, so the IPS section × confidentiality pair is the unit a grant opens. This is what lets the ER flow grant by LOINC section
  • Every author writes to their own repo. Patient-authored and clinician-authored records share a space; each sits in its author's space repo
  • Decimals are strings — atproto disallows floats; see Architecture

3.2 IPS section spaces

One space type per section of IPS 2.0.1 (FHIR 4.0.1). Its collections are the resource types IPS allows in that section; every section also allows DocumentReference. Each space type's collections are in the Lexicon Reference.

Collection NSIDs are the FHIR type in camel case under health.hats.fhir: Condition → health.hats.fhir.condition, AllergyIntolerance → health.hats.fhir.allergyIntolerance.

3.3 Other spaces

Records outside the IPS summary, and the access ledger. Their collections are in the Lexicon Reference.

3.4 Space type declaration

Each space type is a lexicon with "type": "space", per proposal 0016. The name is what a consent screen shows.

key is any because 0016 has no key type for a fixed set; HATS restricts the skey to n, r, v, and 42cfrpart2. The first version builds n and r; the v and 42cfrpart2 spaces come later.

3.5 Protection level: the skey

The skey is the record's HL7 confidentiality code, or — for records under a stricter law — the HL7 policy code for that law, lowercased per the label convention. Every patient has the same full set of spaces, created empty at account creation: every clinical space at n, r, and 42cfrpart2, since Part 2 follows a record's source program rather than its subject[2]42 CFR 2.11, Definitions: “Part 2 program means a federally assisted program…”; v for encounters only, since psychotherapy notes are encounter documents[3]45 CFR 164.501, Definitions: “Psychotherapy notes means notes recorded (in any medium) by a health care provider who is a mental health professional documenting or analyzing the contents of conversation during a private counseling session or a group, joint, or family counseling session and that are separated from the rest of the individual's medical record…”; and the patient and audit spaces at n. Existence is constant, so it reveals nothing to anyone, the coordinator included.

3.6 Discovery

There is no shared index of a patient's spaces. Any index would live in some space, and every reader of that space would see all of it — an entry like "a Part 2 space exists" leaks on its own.

Instead, requesters work out a menu from the published policy and resolve their picks into space addresses (Asking for access). Addresses follow at://{patient}/space/{section}/{skey}. The patient's own apps enumerate everything through their PDS. Every patient has the same set of spaces, so whether a space holds records is learned only by a requester entitled to sync it.

3.7 Restricting a record

A patient can ask for an existing record to move from n to r (HIPAA's right to request restrictions[4]45 CFR 164.522, Rights to request privacy protection for protected health information: “Standard: Right of an individual to request restriction of uses and disclosures. (i) A covered entity must permit an individual to request that the covered entity restrict: (A) Uses or…”). It's the one exception to never deleting a record, and it's a move, not a loss: the content lives on at r, and the trail of where it was stays:

  1. A new record is written in the r space; its prev cites the old record's URI and CID, so the chain stays verifiable
  2. The n copy is deleted — not overwritten. Filler content would be a clinical hazard and would still show that a record existed
  3. The move is recorded in health.hats.audit.log

Best effort, and not retroactive. The move stops future exposure at n. Anyone who already read, synced, or shared the n copy — an institution node, a cached view, a copy taken outside HATS — still has it, and no protocol can recall it.

3.8 Grant records

A request and the patient's answer to it are FHIR R4 Consent resources under a narrow HATS profile. The request is the asker's, status proposed; the answer is the patient's, active or rejected, citing it; a revocation is the yes's new version, inactive. A yes has a root provision, as R4 requires, and one nested permit per section. health.hats.institution.sharingGrant takes the same shape. A yes is one of two kinds: this stay, citing the Encounter, which ends when whoever discharges the patient writes it as finished into the ledger; or until revoked. Every field HATS needs already exists:

A yes counts only when it carries an attestation signed by a key in force, the patient's, or a parent's for their child at n and r: the patient's card, or a passkey the card attested, as a WebAuthn assertion. So a custodial host can store answers but cannot forge them, and passkeys registered before the patient claimed their account count for nothing. Break-glass claims aren't yeses: the person who acted records them. A yes carrying V counts only with the patient's own signature: it is the specific authorization psychotherapy notes require. Each request and answer cites the spec it was made under in Consent.policy, as claims and reads do in AuditEvent.agent.policy. A request names the asker's PractitionerRole, and a parent's answer names the parent as the Consent's performer, a contained RelatedPerson with their HL7 v3 RoleCode.

3.9 Methods

The coordinator serves nothing: it's the spec. Every exchange is a record in the patient's spaces, so the institution node's two procedures are the only health.hats.* methods; what they take, return, and refuse is in the Lexicon Reference, generated from the schemas.

3.10 Open Questions

  • Placeholder choices to confirm — made while authoring the lexicons where the docs were silent: consent-screen names for the non-IPS spaces (e.g. "Access ledger" for health.hats.audit.log)
  • DocumentReference everywhere — IPS allows it in every section, which makes it an escape hatch for putting anything anywhere. Restrict it?
  • Patient story — IPS allows any resource; restrict to narrative? A space declaration's collections may not be a wildcard, so the declaration lists only DocumentReference for now
  • A care team — the patient's own record of who looks after them: FHIR CareTeam, each participant with the period they were on it, so it shows who took over from whom. IPS has no section for it, so it needs a space of its own. It would also say who is responsible after a handoff (HATS.institution.pneumatic)
  • R6 migration — when IPS and US Core publish R6 profiles, move storage in one step
  • Grant basis — a derived grant (notarized consent, transfer) cites its basis by strongRef, but no field is named. R4 Consent.sourceReference can point at a Consent but carries no CID; the alternative is a HATS strongRef field beside the resource
  • Attestation types — the signatures field lists only remote attestations (com.atproto.repo.strongRef) and stays open. The inline types in Record Integrity (author signature, WebAuthn approval, SCITT receipt, RFC 3161 timestamp) have no NSIDs yet
  • Permission set — ATProto Mapping promises a published health.hats.* permission set for consent screens. None is written: which apps get one (the personal app, the institution node) and what each grants is undecided. It must sit at health.hats.<name>, since a permission set reaches only its own NSID group and the groups below it, and the space types span records, audit, and institution

3.11 Notes

  1. 42 CFR 2.51, Medical emergencies: “patient identifying information may be disclosed to medical personnel to the extent necessary to: (1) Meet a bona fide medical emergency in which the patient's prior written consent cannot be obtained”
  2. 42 CFR 2.11, Definitions: “Part 2 program means a federally assisted program…”
  3. 45 CFR 164.501, Definitions: “Psychotherapy notes means notes recorded (in any medium) by a health care provider who is a mental health professional documenting or analyzing the contents of conversation during a private counseling session or a group, joint, or family counseling session and that are separated from the rest of the individual's medical record…”
  4. 45 CFR 164.522, Rights to request privacy protection for protected health information: “Standard: Right of an individual to request restriction of uses and disclosures. (i) A covered entity must permit an individual to request that the covered entity restrict: (A) Uses or…”

Lexicon Reference

Every health.hats.* schema, 62 in all, generated from lexicons/ by pnpm lexicons:reference; pnpm check fails when this page is out of date. Edit the JSON, not this page. What the namespaces mean is in Lexicon Namespaces; every schema here is published from @hats.health.

4.1 endRole

health.hats.institution.endRole, a procedure. An administrator ends someone's role at their institution, when the person didn't choose to go, or records a leaving by revoking the credential. The node writes the ended PractitionerRole, pointing its forward where the administrator says, and a Provenance naming the administrator. Authenticated as the administrator (service auth), who must hold institution.administrator there.

Errors

  • NotAdministrator: The caller holds no institution.administrator role in force there.
  • NoRole: The person holds no role there to end.

4.2 leaveRole

health.hats.institution.leaveRole, a procedure. A clinician leaves an institution: their role there ends now. It's their own act, honored at once, since giving up a role only removes access; an administrator revokes the role credential after. The institution's node writes the ended PractitionerRole and a Provenance naming the clinician. Authenticated as the clinician (service auth).

Errors

  • NoRole: The caller holds no role in force at that institution.

4.3 Space types

4.4 Records

4.5 FHIR collections

A FHIR R4 resource, of the type its row names. The record is the resource itself: its JSON fields as FHIR defines them, plus $type and the HATS integrity fields. Decimals are strings, since atproto has no floats; codes keep their code system's case.

4.6 health.hats.defs

Definitions shared across HATS records: the amendment chain and attestations (Record Integrity).

Record Integrity

Upstream space commits are deniable by design: a leaked commit proves nothing about what a user wrote (see Upstream Changes). Clinical records need the opposite — provable authorship and provable integrity. So in HATS, integrity lives in the record, as a pluggable field any provider can fill.

Not reinventing the wheel: bolting existing parts into a new car.

5.1 The socket: atproto attestations

HATS uses the community atproto attestation spec (Rust implementation: atproto-attestation) rather than defining a signature format.

  • A record carries a signatures array — an open union, so each entry declares its own scheme with $type
  • Inline entries carry a signature and key
  • Remote entries are strong references to a proof record in the attester's own repo
  • The signed content is the record's CID, computed with a $sig object that names the repository DID, so a signed record cannot be cloned into another repo and replayed
  • The spec lets $sig carry extra context fields beyond $type and repository. For space records HATS requires a space field holding the space URI, so a signed record cannot be replayed into a different space by the same author either, and a uri field holding the record's own URI, so it cannot be copied to another record key
  • A record is identified by its attested CID: the CID its attestation signs, computed with $sig and without signatures. Adding a signature changes the CID a record is stored under, but never its attested CID

5.2 Amendment chain

HIPAA's right to amend means correction is additive, never destructive. No HATS flow deletes a record, apart from restricting one: a change is a new version citing the last, and an ending is a status, so the paper trail stays. A person can still delete what's theirs (Sync and reconciliation).

  • Each version carries prev: an array of com.atproto.repo.strongRef (URI + CID) naming the version it amends. The first version has none; a merge of two offline forks names both (see Architecture)
  • An amendment is a new record with a new rkey. The old version stays as its own record. Space repos are a set with no history (LtHash, droppable oplog), so overwriting in place would make prev point at nothing
  • The latest version is the chain head; the full history is recomputable by walking prev
  • prev, and any HATS citation of another record, names it by URI and attested CID, so re-signing a version doesn't break its chain. Re-attesting is always a new version, never an edit in place, and a later version whose attestation fails, unless it only narrows what it amends, ends the chain rather than being ignored

5.3 Providers

Each scheme is just another $type in the union. A record can carry several; a verifier checks the ones it understands.

These map onto the cryptographic tiers in ATS Foundations: signatures settle authorship, the chain and receipts settle integrity. Semantic disputes still need a human.

5.4 Who stands behind a record

A patient's record is theirs, so a patient can add a record to any section: an allergy, a home test result, a vaccine they had abroad. What differs between records isn't whether the patient may hold them but who stands behind them, and every app shows that on every record:

Review, either way

Every change is a new version in the amendment chain, so whoever didn't write it can see exactly what changed, the way a code review shows a diff:

  • Whoever writes a version, the other side reviews it. A patient asks a clinician or lab to verify what they added or edited; a clinician's new version of their own record waits on Home for the patient. Each sees the diff against the version it amends
  • A review signs the version it saw. Approval is an attestation over that version's CID, so the next version starts unreviewed, and the old one keeps its signatures
  • A review never gates the change. A record belongs to whoever wrote it: a clinician's version stands whether the patient approves or not, and a patient's stays reported by them if a clinician won't verify it. Disagreeing attaches a statement instead, which for a clinician's record is the patient's statement of disagreement[1]45 CFR 164.526(d)(4), Amendment of protected health information: “Recordkeeping. The covered entity must, as appropriate, identify the record or protected health information in the designated record set that is the subject of the disputed amendment and append or otherwise link the individual's request for an amendment, the covered entity's denial of the request, the individual's statement of disagreement, if any…”
  • A patient can't edit a clinician's record. They ask its custodian to amend it, which is their right[2]45 CFR 164.526, Amendment of protected health information: “Standard: Right to amend. (1) Right to amend. An individual has the right to have a covered entity amend protected health information or a record about the individual in a…”. The custodian has 60 days to answer[3]45 CFR 164.526(b)(2), Amendment of protected health information: “Timely action by the covered entity. (i) The covered entity must act on the individual's request for an amendment no later than 60 days after receipt of such a request…”, and a refusal leaves the patient's statement of disagreement attached[1]45 CFR 164.526(d)(4), Amendment of protected health information: “Recordkeeping. The covered entity must, as appropriate, identify the record or protected health information in the designated record set that is the subject of the disputed amendment and append or otherwise link the individual's request for an amendment, the covered entity's denial of the request, the individual's statement of disagreement, if any…” to the record
  • Requests follow care relationships. A correction goes to the clinician who wrote the record; a verification to a clinician the patient already sees. Never to a queue, and never to a stranger. If the clinician has left, the patient can ask the person their institution names instead (When someone leaves). The request is a FHIR Task in the patient's repo beside the record (change to correct, approve to verify), registered with the coordinator through health.hats.ask. Asking opens just that record's section to that clinician, under PATRQT, until they answer or it's due. They answer by verifying (a Provenance signed over the record), correcting (a new version of their own record, which the patient reviews), or declining with a reason. A patient's own answers to a version are Provenance records in their repo too
  • Clinicians see the same labels. A patient-reported allergy reaches an ER as patient-reported, which is how a clinician weighs it today
  • FHIR's own verificationStatus (unconfirmed, confirmed) is a clinical judgment about the finding. It's separate from who vouches for the record, and patient-reported records start unconfirmed

5.5 Deniable vs. transferable

A signed record is transferable: if it leaks, it is provably authentic. That is right for clinical records — signed charts work this way today — and wrong for a patient's personal notes. Signing is opt-in per collection.

5.6 ZTK: the Mina idea

The "zero trust token" this doc grew from turned out to be Mina: a blockchain that stays a 22 KB fixed size by recursive zero-knowledge proofs, each proof verifying the previous one, so one small proof stands for the entire history.

HATS takes the technique, not the chain:

  • Use — a constant-size proof per record that its amendment chain is intact and every amendment was signed by an authorized author, revealing no content. A court, insurer, or privacy officer gets "never altered after T" without seeing PHI
  • Don't use — Mina's public chain, its accounts, or any global ledger. Identity stays the DID, and proofs of health records on a public chain are a metadata leak
  • Cost — proving is heavy (minutes of CPU per proof): a job for the institution's server writing the record, not a patient's phone. Verifying is cheap
  • Maturity — Mina's mainnet launched in 2021 with modest adoption. o1js is a prototyping candidate, not a commitment

5.7 Upstream feedback

  • Standardize a space field in $sig. In spaces a record lives at (space, author). The attestation spec requires only $type and repository in $sig and allows extra context fields, so HATS binds the space URI itself. But no standard field names the space, so a generic verifier won't check it. A standard space field for space records would close that

5.8 Open Questions

  • Minimum per collection — is an author signature the only hard requirement for clinical records, with everything else optional?
  • Key rotation — verifying an old signature needs the author's key as of signing time. PLC's audit log provides history for did:plc; what about did:web?
  • Spec stability — the attestation spec is a community draft; pin a version
  • What the ZK proof proves — chain validity only, or properties too ("no amendment after T", "authored by a clinician licensed at the time")?
  • Transparency service metadata — a log entry reveals that something was recorded at T. Submit opaque hashes only, and decide who runs the log

5.9 Notes

  1. 45 CFR 164.526(d)(4), Amendment of protected health information: “Recordkeeping. The covered entity must, as appropriate, identify the record or protected health information in the designated record set that is the subject of the disputed amendment and append or otherwise link the individual's request for an amendment, the covered entity's denial of the request, the individual's statement of disagreement, if any…”
  2. 45 CFR 164.526, Amendment of protected health information: “Standard: Right to amend. (1) Right to amend. An individual has the right to have a covered entity amend protected health information or a record about the individual in a…”
  3. 45 CFR 164.526(b)(2), Amendment of protected health information: “Timely action by the covered entity. (i) The covered entity must act on the individual's request for an amendment no later than 60 days after receipt of such a request…”

Threshold Authority & Notarized Consent

How the patient's authority is held, exercised, and recovered — across the full Autonomy Spectrum, including when the patient can't sign for themselves.

The guiding split: the card is master over access; the quorum is master over the authority itself. This preserves sovereignty (you control access unilaterally) and recoverability (losing the card can't lock you out permanently).

6.1 The card is the master key

The authority key lives in a PIN-gated chip card (secure element, contact + contactless), not the phone. The card is the key and the control plane; any device is just a reader. Tap it on a phone or insert it in a kiosk — the device becomes a dumb terminal with no app-side key custody and no enrollment.

One card, two standard applets, because the two jobs need different signature formats:

Both are equally secure — hardware-held keys behind a PIN. The split exists because the PLC directory only accepts plain signatures over an operation, and WebAuthn always wraps its signature in an envelope. No code on HATS's side can convert one into the other; PLC would have to accept WebAuthn signatures (see Upstream feedback). Browsers can't reach PIV, since Web NFC reads only NDEF tags, so master operations need the native app or a USB reader (Architecture).

This is the sovereignty floor: it works on a borrowed device, costs little to produce, and can be issued / tracked / revoked by the governance layer. Separating the key (card) from the interface (any reader) is what lets a user with no phone still hold genuine control.

6.2 Situational authorization

6.3 Card vs. quorum: theft and the 72-hour window

Day to day the card grants, revokes, and approves alone. Each of those is a record in health.hats.audit.log that a later record can undo.

The card's PIV key is also a real DID rotation key, so card + PIN can sign PLC operations — including removing the quorum key. A stolen card + observed PIN can therefore read records, grant access, and rotate the DID's keys.

Recovery rests on rank and time: the quorum key outranks the card key and can undo anything the card signed, but only within PLC's 72-hour window. So the window is watched. The patient's app and the quorum watch the PLC operation log for the patient's DID, and alert the circle on any rotation. A rotation nobody contests within 72 hours is final.

Made like a bank card

HATS cards reuse the payment-card supply chain, repurposed — not the patient's actual bank card, whose chip keys belong to the bank:

A YubiKey 5 NFC carries both applets too, for people who'd rather carry that. Losing or destroying the card is a quorum reissue, below.

Identifying the holder

Reading the DID says whose record to ask about, not that the person holding the card is that patient. For someone unresponsive on a sidewalk, the card in their pocket may be the only identification they carry, so the card also identifies its holder, in two layers:

  • The face carries the holder's name and photo, so a medic can match an unresponsive person to their card. Date of birth is the patient's choice. Like a driver's license, a lost card shows these to whoever finds it
  • The chip carries an identity credential in the ISO/IEC 18013-5 mobile document format, the one mobile driver's licenses use. It's signed by whoever checked the holder's identity, and readable without the PIN by a reader that asks only for the fields it needs
  • The credential states how well identity was checked, as a NIST SP 800-63A identity assurance level, and by whom. A clinician who has known an unhoused patient for years can attest that much, with no government ID behind it, and say so. HATS says what was checked and never claims to be government ID

There is still no central index: the photo is on the patient's card, not in a lookup service (ER flow).

6.4 DID rotation keys

The patient's DID is a did:plc, which lists up to five rotation keys in descending authority. HATS orders them to match the card / quorum split:

  1. Quorum key — threshold-held; master over the authority itself
  2. Card key — the card's PIV key, P-256 (PIV offers P-256 and P-384; PLC accepts P-256); the patient's own master key
  3. Host keys — a PDS's own: a first-contact custodian's until the patient claims, or any PDS hosting a shared DID

For 72 hours, a higher key can undo operations signed by a lower one. After that, history is final — otherwise a stolen key could rewrite years of operations and no DID's state could be trusted. The window only limits undoing the past: a higher key can remove a lower one at any time, so the patient's power over a custodian is permanent.

Controlling the DID also reaches the data: whoever holds a rotation key can install their own signing key and request space credentials as the account. A rotation key is a data key in practice, which is why key management carries HATS's security.

Recovering the account, not just the DID

A rotation key moves the DID, but logging back into a PDS account still runs through the host's email reset. A community proposal lets a rotation key do it instead: a short-lived, single-use JWT (typ: recovery+jwt) signed by the rotation key replaces the emailed token in com.atproto.server.resetPassword. Only a key ranked above every key the host signs with qualifies, so a host's own key, leaked or not, never does.

That rule matches the order above: the card and the quorum qualify, and a custodian never does. The card's PIV side can sign the token as ES256, in the native app or at a kiosk; its FIDO2 side can't, for the same reason it can't sign PLC operations.

As of October 2026 it runs in the atproto-pds and atproto-entryway implementations, not in Bluesky's PDS, so HATS uses it where a host supports it and doesn't depend on it.

6.6 Threshold authority

For durable incapacity — the patient cannot manage their access policy at all. A defined quorum manages it on their behalf.

A patient's access comes down to the signed yeses in their ledger, which the patient's managing app checks at each pass (Asking for access). Authority in HATS is authority over those yeses. The situational table above compiles down to it: card signature → a yes; break-glass → a claim admitted under the ER flow's tiers; notarized consent → a temporary yes, after the first version; quorum partial-sigs → authority-level operations on the DID's rotation keys. How the quorum says yes for the patient comes later, with the rest of representation. The yeses, FHIR Consents in health.hats.audit.log, are the auditable record.

Mechanism should be threshold ECDSA, not Shamir reconstruction. The key the quorum controls verifies plain ECDSA: PLC rotation keys are secp256k1 or P-256 signing ECDSA-SHA256 in low-S form. Schnorr threshold schemes such as FROST (RFC 9591) are simpler but produce signatures PLC doesn't accept. The key is never reassembled in one place; each shareholder produces a partial signature and K partials combine into a valid signature without the full key ever existing. Shamir's reconstruction moment is a single point of compromise — unacceptable in a trust-minimized health context.

For incapacity, the quorum activates only when the patient cannot will their own signature and no guardian governs. The one other job is recovery for a conscious patient: card reissue and device recovery go through the quorum at the patient's request. Precedence for incapacity: Guardian → Threshold quorum → Break-glass. A valid guardian delegation always precedes the quorum; threshold authority is the fallback when no guardian exists or is reachable. A conscious patient with their card is always unilateral — neither guardian nor quorum can override a competent patient.

Quorum composition — who holds shares (the card, providers, a public-benefit "PDS of last resort") and what K-of-N — remains open below.

6.7 Validator / shareholder eligibility

Same problem as social-media identity validation: who is allowed to vouch? Answer: licensed healthcare entities, piggybacking on existing medical licensing and accreditation. This inherits a vetted, revocable, publicly-checkable trust root instead of building one. But it's narrower than it first looks, and four distinctions matter:

Institutional accreditation, not individual licenses. A named person signs as validator, and what makes them eligible is their institution's accreditation (NPI, CMS certification, Joint Commission accreditation), not their personal license. Institutions are more stable, persist across staff turnover, have legal departments, and already hold BAAs. Individual licenses are a secondary signal, not the anchor.

Inherited revocation. Lose accreditation → lose validator standing. No need to invent disbarment; the boards already run it. Revocation latency varies by board, though — a real consideration.

Eligibility ≠ selection. This is the load-bearing separation. Licensing answers "are you allowed in the validator pool" (eligibility). It does not answer "which pool member validates this specific event" (selection). A licensed hospital rubber-stamping a friend's attestation is still licensed — so licensing does nothing for collusion. These are two separate locks; do not let eligibility masquerade as solving selection (see Open Problems).

Jurisdiction fragmentation. There is no global medical license — about 70 US state and territorial medical and osteopathic boards, then every country's own system, each with different APIs, formats, and revocation latencies. Institutional accreditation fragments the same way, across state health departments, CMS, and accreditors such as The Joint Commission. A licensing-grounded validator pool is really dozens of disjoint pools. Scope the first version to one jurisdiction (e.g. Washington State) explicitly; treat cross-jurisdiction federation as a later, hard problem.

atproto bridge — verifiable credentials. Model a validator as a DID holding a currently-valid accreditation VC issued by a recognized board. Pragmatically at first, an oracle scrapes the public board registry and attests to status (board-issued VCs are the ideal end state). This is the same VC machinery you'd want for credentialing providers generally, not just validators — so it's reusable infrastructure, not a one-off.

6.8 Open Questions

  • Validator selection — if the treating provider picks the validator, they pick a friend (collusion). Selection probably can't be the provider's choice: randomized draw from the licensed-validator pool, or reputation-staked validators who lose standing if caught rubber-stamping. This is the lever that makes attestation worth more than a timestamp.
  • Duress PIN — a coerced patient (abusive guardian, trafficking — real risks in the population this serves) needs a PIN that signs a grant while silently flagging the audit log.
  • Quorum composition — who holds shares (the card, providers, a public-benefit "PDS of last resort")? What K-of-N?
  • Quorum vs. card on a shared DID — the quorum outranks the card so it can undo a thief, but PLC can't limit a rotation key to some operations. On a DID the patient also uses for social apps, a quorum could move their handle and PDS too, and with rotation-key recovery, a stolen card and PIN could reset the password they post with. Put the card above the quorum, or keep the order with the coordinator's PLC watch as the check?
  • The card and other ID — a HATS card that identifies its holder sits beside a driver's license or state ID (REAL ID, federally enforced since May 2025), a mobile driver's license, a phone's unsigned Medical ID, and engraved medical alert jewelry. Should HATS lean on government ID where a patient has it, to raise the assurance level, or stay apart from it? The people HATS helps most often have none, since replacing documents costs money and an address. And where does a health-issued credential stop being usable as ID: may a shelter or a pharmacy rely on it, and who is liable when it's wrong?
  • Bracelet or card — medical alert bracelets are where EMS is trained to look, they stay on the body when a wallet is lost or stolen, and they survive a shower. A bracelet can hold an NFC secure element, but only contactless, so it can't take the card's contact interface or a kiosk's card slot. One split: the bracelet carries the DID, the photo-matched identity, and the emergency key, and the card keeps the master key somewhere safer. The cost is two things to issue, track, and replace
  • Reclaim & dispute — when the patient recovers their card, all on-their-behalf actions (notarized grants, quorum changes) surface for review and contest. Same retroactive-audit loop as Progressive Onboarding.

ATProto Spaces Mapping

HATS maps onto atproto spaces (proposal 0016; alpha shipped August 20, 2026). This page covers the HATS-specific mapping. What HATS asks of upstream is in Upstream: atproto Spaces Alpha; the general primitive is in ATS Foundations.

7.1 Concept Mapping

7.2 URI Structure

Spaces reuse at:// with a literal space segment:

Segment by segment in Lexicon Namespaces.

The space alone — at://did:plc:patient/space/health.hats.records.allergies/n — is the sub of the delegation token and the space credential. The delegation token and client attestation are addressed to the space host, did:plc:patient#atproto_pds.

The HATS-specific point: the space type is the HIPAA compliance boundary and the OAuth consent boundary. Read access is all-or-nothing per space, so per-modality space types are required, not just preferred — one universal health.hats.space would be illegible and ungrantable. Each space type declaration carries a name for consent screens, so the screen reads "give this app access to your Allergies and intolerances" rather than "access to your health records."

7.3 Gaps HATS fills

  • Roles at the door — a standard host knows nothing of a clinician's role; the patient's managing app reads it at each pass. W3C credentials and status lists come later
  • HIPAA amendment — space repos are a set with no history, so the repo gives neither tamper evidence nor an amendment trail. Correction is an additive amendment chain carried in the records, and integrity comes from record signatures, not commits (Record Integrity)

What HATS still needs from upstream is in Feedback for the spaces team.

Upstream: atproto Spaces Alpha

HATS builds on atproto spaces, specified in proposal 0016. This page lists the upstream facts HATS depends on, each with the 0016 section it comes from, and what HATS asks upstream for. 0016 calls itself "a proposal, not the final specification", so every fact here can move. Changes that are still open upstream are marked as proposals, not facts.

As of November 8, 2026: the November 5 alpha release. Other sources: each release's migration notes in alpha-migrations/, the alpha updates thread, and Space commitment changes.

8.1 Status

  • Alpha since August 20, 2026. Releases land on Thursdays, often with breaking changes. Each comes with migration notes and is posted to the alpha updates thread
  • Reference PDS — ghcr.io/bluesky-social/atproto:pds-spaces-alpha. The tag floats to the latest release, so the demo pins the image by digest. npm snapshots are published under the alpha dist-tag
  • Hosted alpha PDS — an invite-only developer sandbox, deleted after the alpha
  • pds.js — an experimental PDS for Node.js, Deno, or Cloudflare Workers that implements spaces
  • Proposed: a new URI syntax (October 28, 2026, a draft tied to the beta). Space addresses would move "space" to the front, at:space/{spaceDid}/{spaceType}/{skey}/{authorDid}/{collection}/{rkey}, and public records gain at:public/…, with today's at:// kept as legacy for public data. The order after the prefix is unchanged. HATS builds and parses these only in spaceUri, spaceRecordUri, and parseSpaceUri (packages/core/src/spaces.ts), so adopting it is a change there, plus the example addresses in these docs (proposal)

8.2 Model

8.3 Space policy

Every PDS MUST support three baseline policies, and MAY support more. A space's policy is one object, discriminated by $type; updateSpace replaces it whole, and changing its $type discards the old policy's state, a member list included. Lifecycle methods are com.atproto.space.createSpace, updateSpace, getSpace (the owner only), and deleteSpace.

How HATS uses them (Lexicon Namespaces, Architecture):

  • Every patient space is managedspace, the ledger and inbox included, naming the patient's own managing app, which answers checkUserAccess from the patient's records (Architecture). The coordinator is the spec, and decides nothing
  • The ledger and inbox are written by anyone: the managing app lets anyone asking or breaking the glass record it there, in their own repo, and lets only the patient and their delegates read the ledger, and its owner the inbox
  • No removeWriter. When a write yes ends, a writer's later writes go untracked, and their earlier records stay findable
  • The demo runs no managing app: its record spaces are memberspaces, a yes puts the asker on the lists it covers, and its ledger and inbox are memberspaces with publicWrite (The Demo)

8.4 Credentials

HATS consequence: there is no long-lived or "replica" credential. A backup provider or institution node is a syncer that keeps renewing, so it syncs only while someone there holds a grant.

8.5 Sync

Planned: a Jetstream for spaces (post, November 6, 2026; not shipped, with mechanism details to come). One replay-then-live stream covers every space a backend follows, with a space field on each event. The service holds no account and no OAuth tokens: it borrows a short-lived delegation from a user with read access, and when that user signs out or loses access, it finds another reader or stops. Space authorities send it signed write notifications, addressed to a service DID of its own. The post tells apps to hide a deactivated member's records in every space.

HATS consequences:

  • It's most of an institution node's sync layer, so a node's sync waits for upstream's example
  • Borrowed access matches how a node works: it syncs only while someone there holds a grant
  • A chart doesn't hide its authors. A clinician deactivating can't take their notes out of a patient's record, so HATS apps show the notes with the author marked as deactivated
  • A node's identity needs re-checking. The stateless coordinator plan has a read through an institution's node count only from a client that institution lists, and the post gives a sync service a service DID

8.6 Commits

The commit lets a syncer check its copy against the source; it is not evidence of authorship.

  • Shape (0016 §Commit) — { ver, repo, space, rev, data }, with no signature. data is sha256 of a LtHash set hash: a 2048-byte state of 1024 little-endian uint16 lanes, to which each record adds the BLAKE3 XOF expansion of {collection}/{rkey}/{cid}. It is a set: no history, no write order
  • MACs, not signatures — for each MAC-bearing read (getLatestCommit, getRepo, listRepoOps, getRecord), the syncer derives a fresh shared secret against the author's #atproto_kem key, framed per RFC 9180, and sends its half in Atproto-Space-Want-Mac. The repo host returns an HMAC of the commit, or of the record's URI and CID, in Atproto-Space-Mac. listRecords, getBlob, listBlobs, and listRepos carry none
  • Deniability is the design goal: a leaked response proves nothing about authorship to a third party

HATS consequence: commits never give transferable proof, so integrity lives in the records (Record Integrity).

8.7 OAuth scopes

0016 §OAuth scopes.

  • Syntax — space:<spaceType>[?authority=<did>][&skey=<skey>][&collection=<nsid>...][&action=<action>...][&manage=<op>...]
  • authority defaults to self, so a clinician's app reading a patient's spaces must name the patient's DID or *
  • Read is all-or-nothing per space — no per-record, per-collection, or per-author read. read also grants getDelegationToken; read_self covers only the holder's own repo, and is what getSpace and listMembers need
  • Write actions (create / update / delete) are constrained by collection, which defaults to the declaration's collections and follows later changes to it
  • manage (create / update / delete on the space itself) is never granted by default; manage=update covers updateSpace, member changes, removeWriter, and importSpaceMeta
  • Consent shows the declaration's name and the authority's bidirectionally verified handle (else its DID); wildcard type plus wildcard authority gets a prominent warning
  • Permission sets may bundle space permissions, but each must name a concrete space type

8.8 Deletion

HATS's answer for regulated syncers is in Regulatory Model: authored records stay with their author, relied-on records are retained with the encounter, and retention law governs the rest.

8.9 Feedback for the spaces team

For the spaces office hours and the WG Private Data forum:

  • Pushing inbox writes to the owner and whoever they name, so a notice reaches them without their app polling
  • Revoking credentials by user — notifyCredentialRevoked goes by jti, so a revocation waits out the 10 minutes a credential lasts unless the authority tracks every one it minted
  • Attributing reads through a sync service — a service reading on one user's delegation shows the space host one user, while the app decides who sees what. A whole hospital could read under one clinician's delegation, and the patient would see only that clinician. Regulated readers need each read attributed to a person
  • Deactivation and retained records — hiding a deactivated member's records suits social data. Medical records have to stay readable, so regulated apps need an acknowledged exception
  • What a sync service presents — whether it attests as a client as well as holding a service DID, and which of those a host sees on each read
  • Space binding for record signatures — the community attestation spec's $sig requires only $type and repository and allows extra context fields. HATS binds the space URI there now; a standardized space field for space records would let any verifier check it (see Record Integrity)
  • Transferable proofs, when wanted — deniable commits are right for social data. Regulated data wants transferable proof for some records. A standard way for a record to carry its own signature would beat every app inventing one
  • Retention vs. deletion — "syncers delete on space deletion" is unlawful for a hospital under retention rules. Regulated syncers need a defined exception, or at least an acknowledged one. HATS's own answer — authored records plus reliance capture — is in Regulatory Model
  • #atproto_kem where the user holds every rotation key — adding the key to an existing DID document takes a PLC operation. Once a HATS patient has claimed their DID, only their card or quorum can sign one (DID rotation keys), so the host can't add the key on its own, and an account without it can't serve MAC-bearing reads. Defining what syncers do when it's absent would keep those accounts syncable until the patient signs
  • A separate host for space repos — an account's space repos live on its repo host, so a person on a social PDS can't keep health records elsewhere without moving the whole account. A DID entry for a space-repo host would let one identity keep its posts on one host and its regulated records on another
  • A standard way to publish an encryption key — not spaces, but atproto identity. Anything that encrypts to an account needs that account's encryption key, bound to its DID, and today each app invents its own: Germ, which brings end-to-end encrypted messaging to atproto, puts its key in the profile text and says it would move "if we had a standardized way for PDS's to publish an E2EE key" (Germ). #atproto_kem isn't it: that key derives MAC secrets and encrypts nothing. HATS needs the same for clinicians and patients
  • PLC: accept WebAuthn-signed operations — not spaces, but atproto identity. PLC only accepts plain signatures, so passkeys can't hold a rotation key. Accepting WebAuthn assertions would make passkeys first-class DID control for every atproto user; HATS works around it with a two-applet card

ATS Foundations

ATS (Authenticated Transfer Spaces) is an umbrella for projects building on atproto spaces — AT Protocol's permissioned data layer, designed by Daniel Holmgren at Bluesky as proposal 0016 and shipped as an alpha on August 20, 2026. HATS is one project built on this substrate; this doc captures the shared foundational primitives HATS inherits rather than restates.

An owner holds their DID and is the authority for their own spaces, every party keeps what it writes in its own repo, and apps read with short-lived, scoped credentials. The social framing of spaces is just the entry point — the primitives are general purpose.

Note: "ATS" is mildly redundant — ATP is already Authenticated Transfer Protocol, so ATS is just ATP's spaces. Acknowledged, accepted. HATS (HIPAA Authenticated Transfer Space Specification) inherits the same double-nesting by design.

9.1 Design Ceiling

The protocol is intentionally a binary audit mechanism, not a trust provider or governance layer. Trust is a byproduct of accountability. Governance is external and pluggable.

The protocol only needs to guarantee:

  • Both records exist
  • Both are signed
  • Both reference the same CID
  • Neither has been altered

"Signed" means a signature in the record itself (Record Integrity), not the repo commit — upstream commits are deniable by design. atproto spaces supply the first and third guarantees; HATS's record attestations and amendment chain supply the second and fourth.

Everything above that line — arbitration, dispute resolution, fraud investigation, regulatory compliance, membership governance — is out of scope by design. Courts, regulators, hospital boards, payment processors: they all consume the audit trail as input. The protocol doesn't need to know they exist.

Why this is a feature, not a limitation

Social spaces need designed-in governance because there's no external legal framework to fall back on — hence the arbiter, cross-modal scope, and community-DID ownership questions in Daniel's design diary. Commerce and health already have legal frameworks. The law is already the trust layer. The protocol's job is just to make evidence cheap to produce and expensive to dispute.

A triangular trust formula (two parties + protocol arbiter) is unnecessary complexity. The binary model — two signed, CID-linked records — is sufficient. If there's a disparity, the parties submit their records to whichever external arbiter is appropriate. The protocol doesn't need to know which one.

Jurisdiction-agnostic by design

The same bilateral record works whether the arbiter is:

  • A US federal court
  • An EU GDPR authority
  • A hospital ethics board
  • A Stripe dispute team
  • Two people settling over coffee

The audit trail is the constant. The governance layer is pluggable, external, and not the protocol's problem.

Make the truth cheap to produce and expensive to dispute. Everything else is someone else's problem.

9.2 Metamorphic Bilateral Records

A core ATS primitive. The same event exists as two records — one in each party's own space repo — each shaped by their perspective, linked by a shared reference: a com.atproto.repo.strongRef (URI + CID).

Under atproto spaces, every account writes only to its own space repo, and a space is the aggregation of those per-author repos. So both sides of a bilateral record sit in the same space, in different repos:

Neither party owns "the truth" — the truth is the intersection. Disputes are resolved by comparing both records against the shared reference. No central ledger required.

This is double-entry bookkeeping applied to sovereign data. Double-entry bookkeeping has been the foundation of accountable commerce since the 15th century — every transaction recorded as both a debit and a credit, owned by different parties, reconcilable by auditors. ATS generalizes this:

Authorship and custody

Each party writes its own side, and only its own side. The patient controls the space — as space authority, they decide who reads and whose writes are tracked. The author holds custody of what they wrote: a clinician's note lives in their own repo inside the patient's space (ER write-back). The patient cannot edit the hospital's record, and the hospital cannot write into the patient's repo.

Non-repudiation does not come from the repo. Upstream commits are deniable by design: a commit proves integrity to a syncer in the sync flow, and nothing to a third party. A record that must be provable carries its own signature — the community atproto attestation spec, opt-in per collection (Record Integrity). A clinician signs their note with their DID key; neither party can alter the other's contribution without breaking the signature.

Co-signing is a countersignature, not a commit property. This is what payment processors already do — Stripe is the trusted co-signer, and both parties agree Stripe's receipt is ground truth. In HATS the co-signer is a remote attestation, such as the Validator.

Generalizes beyond commerce and health

Any bilateral relationship with ongoing state:

  • Employment records
  • Loan agreements
  • Contracts and NDAs
  • Tenancy / lease records
  • Insurance claims

Lying at the moment of recording

  • Unilateral false record — detectable: the counterparty's repo has no matching record, or the reference doesn't resolve to a record with a valid attestation
  • Colluding on a false shared reference — cryptography can't help; this is fraud, same as today
  • Retroactive alteration — detectable, not impossible. A signed record can't be changed without breaking its signature, and a correction is a new record naming the old one in prev (amendment chain). Space repos are a set with no history, so the repo itself won't reveal a silent deletion — every other syncer's signed copy will. Transparency receipts pin a record's existence at time T
  • Deletion on request — upstream expects syncers to delete when a space or account is deleted, which collides with medical-record retention law (see Upstream)

9.3 Core Thesis

ATS is not a trust protocol. It's an accountability protocol. Trust is what accountability looks like at scale.

"Own your data" is a feature. Accountable by default is a value proposition.

The protocol doesn't establish trust between parties — it makes lying expensive and detectable. Trust emerges as a rational response to that. If every transaction, clinical note, or order record is signed by its author, held by every party it touches, and corrected only by adding to it, lying isn't impossible — it's just immediately and permanently visible. The audit trail is the deterrent.

This collapses the distinction between "did this happen" and "can I prove this happened." Right now those are two different questions with expensive infrastructure between them — lawyers, discovery, expert witnesses. A cryptographic audit trail makes them the same question. The receipt is the proof.

Access is accountability. Every read is attributable to a known party for a stated reason, so access is governed by what it costs to abuse, not by what it's possible to reach. Break the glass is the purest case — see ER: Unresponsive Patient.

Arbitration tiers

Commerce lives almost entirely in the first two tiers — which is why it's automatable. Health bleeds into the bottom two — but the protocol still eliminates the vast majority of lower-tier disputes that currently get escalated unnecessarily because the audit infrastructure doesn't exist.

The hashing primitive

Cryptographic hashing gives proof of existence and integrity at a moment in time without any third party:

  • A signed hash proves a document existed, unchanged, at T1
  • Neither party can alter their record without breaking the signature
  • Append-only amendment chains (each amendment references the prior version by CID) handle legitimate mutability
  • A space repo's LtHash digest proves a syncer's copy matches the host — useful for sync, worthless as evidence, since commits are deniable. Evidence is the record signature
  • Contradictory records can both have valid hashes — cryptography proves integrity, not truth. Semantic disputes still need human arbiters.

If something is as easy to prove as the sky is blue, trust is a given.

9.4 Shared Concepts

The Core Pattern

Every ATS project follows the same shape:

  1. Owner holds a DID and is the space authority for their spaces; their PDS is both repo host and space host by default
  2. Requester's app gets a delegation token from the requester's own PDS and exchanges it with the space authority for a space credential, adding a client attestation when the space gates on app identity
  3. Space credential is read-only, short-lived (10 minutes default, 60 maximum), signed by the space authority, and bound to a key the app holds
  4. Access revocation = the authority stops issuing; outstanding credentials expire, or are revoked early by jti
  5. Audit = attested records in the owner's audit space, each written by its author into their own repo

Addressing

Spaces reuse at://. A literal space segment where a public collection NSID would sit marks the URI as a space address; resolution is credentialed, not public. The space authority comes first because the author's records are only reachable through the space.

HATS's types, keys, and collections are in Lexicon Namespaces.

Partitioned Data (not Colocated)

Each member stores their own records in their own space repo, on their own repo host. The space host is the coordination point (credentials, the writer set, write notifications), not the data host. Colocated hosting reintroduces the resource, moderation, and custody problems that atproto was built to avoid.

Space Credentials

Three tokens, all existing parts:

Key binding stops a repo host from replaying a credential it was shown against other hosts. Faster-than-expiry revocation is com.atproto.space.notifyCredentialRevoked, naming credentials by jti. There is no long-lived replica credential: a backup provider is a syncer that keeps renewing.

Sync Model

Pull-based. Each space repo commits to an LtHash set-hash digest over its current records — order-independent, updated incrementally, and history-free. A syncer keeps its own running digest; when it matches the host's, the copy is exact.

  • Incremental — com.atproto.space.listRepoOps returns operations since a revision. The oplog is a transport optimization the host may compact or drop; a syncer that loses its place falls back to full-state recovery
  • Notifications — repo hosts send notifyWrite to the space host, which sequences them across the whole space; syncers subscribe with registerNotify

Because the repo has no history, HATS keeps history in the records: the amendment chain.

Default-Deny & App Allowlists

Resolved upstream. A memberspace can set allowedApps, checked against the attested client_id from the client attestation, so the list is enforced, not advisory. A credential is minted only if the policy authorizes the user and allowedApps the app. allowedApps does not gate writes.

HATS accredits people, not apps: accreditation is of credentials (the EHR is a client of the institution node; see ER setup).

Prototype

A thin working slice of HATS on three pieces of hardware: a home server (Intel N150), Cloudflare Workers, and a phone. Synthetic patients only. The goal is one end-to-end run of the ER flow, not a product.

10.1 Scope

Proves:

  • A clinician scans a patient's QR code, requests ERTREAT, and reads allergies and medications
  • The patient's managing app admits each reader, and the patient's PDS mints the credential; the institution node syncs and serves IPS Patient/$summary on the LAN
  • The patient's phone shows the access as it happens, and the audit record lands in health.hats.audit.log
  • The institution node keeps serving after its internet connection drops

Not yet: real cards, threshold quorum, HATS.institution flows, record attestations beyond the grant.

10.2 Topology

The N150 also runs a live NVR and other services. Everything on it stays light: pulled images, no large local builds, capped CPU where a command allows it.

10.3 Data and HIPAA

HIPAA covers protected health information about real people, held by covered entities and their business associates. Synthetic patients are no one, and the prototype is not a covered entity, so HIPAA does not apply — and neither does the FTC rule, which covers real consumers. Three rules keep it that way:

  • Synthetic only. No real records, including one's own, ever enter a test node
  • Synthea sample data, downloaded — the published FHIR R4 sample set, not generated locally
  • Labeled synthetic. Test accounts use a synthetic- handle prefix so nothing reads as a real chart

Test DIDs live on the public PLC directory. A dozen is normal developer practice; hundreds would be spam.

10.4 Roster

Twelve patients, built for coverage, not proportion: every category appears, none is weighted. Clinical histories come from Synthea; demographics and HATS-specific setup are set by hand.

Every column cycles through its values: all seven federal race / ethnicity categories plus multiracial; man, woman, non-binary, trans man, trans woman, declined, and not yet recorded; ages from newborn to 95. Sensitive traits are deliberately spread so no group carries a stereotype. The pairings in this table are test assignments, not correlations.

10.5 Encoding the roster

Records are stored IPS-shaped — IPS is international and already defines the section model. US Core 9 is an interface, not storage: the institution node presents records as US Core when a US EHR asks, because certified EHRs are tested against it. Gender follows HL7 Gender Harmony through the FHIR extensions pack's R4 package (hl7.fhir.uv.extensions.r4).

No health-IT code set (CDCREC, US Core) aligns with the 2024 race standard yet: CDCREC 1.3 (October 2024) explicitly does not, and federal agencies have until March 28, 2029 to adopt it. Storing detailed CDCREC codes means no re-collection when it lands.

10.6 Build order

  1. Coordinator — the policy module in packages/core, which every app imports
  2. Patients — accounts on the spaces-alpha PDS; IPS-section spaces, created empty
  3. Load — Synthea bundles split into section records, demographics set per the roster
  4. Institution node — container on the N150: syncer plus Patient/$summary on the LAN
  5. Phone — the Capacitor app: access log, grant approval signed with a passkey (WebAuthn)
  6. Demo — the ER flow end to end, then pull the N150's internet and read again. The public deployment is planned in demo/
  7. PIV — claim and recovery: over NFC in the phone app, and over USB in the laptop tool

10.7 Development-only tools

Tools for building and testing HATS on a developer's machine or the prototype's LAN. None of them is part of any deployment — a production institution node, coordinator, or personal app never depends on them.

proto.broker — confidential OAuth clients on local domains

10.8 Open Questions

  • Broker hostname and version — which hats.health subdomain the self-hosted proto.broker runs on, and which release it pins
  • Spaces alpha churn — alpha releases land on Thursdays, often with breaking changes; pin the PDS image and SDK versions