Skip to content

Repository files navigation

Relay: ambient AI turned the clinical conversation into a note. Relay turns it into actionable intelligence.

The console  ·  How it works  ·  Architecture  ·  Quickstart  ·  Safety  ·  Roadmap


Relay is an agentic operations platform for inpatient nursing. Its core idea: a promise made out loud at the bedside, like "blood work every morning," "we'll adjust her blood-pressure medicines based on the kidneys," "I'll call your daughter every evening", becomes an accountable operational object with an owner, a schedule, and a trigger, continuously checked against the patient's changing chart. When the data and the promises intersect (a creatinine rise meets a spoken commitment to review renal dosing), Relay's agents propose the nursing action, a deterministic policy gate tiers or blocks it, and the charge nurse approves it. Every step lands in an immutable audit trail.

Categorically, it is the ontology-first pattern that redefined intelligence and logistics work, applied to the care delivery floor:

The EHR System of record. Documents what happened.
Relay System of action. A live ontology of the unit (patients, nurses, commitments, vitals, labs) with agents that turn state changes into gated, human-approved operations.

The product itself is the plan, the sheet, and the handoff:

  • the prioritized shift huddle and the escalation the nurse approves,
  • the printed assignment sheet,
  • the SBAR handoff.

The on-screen console is deliberately named the Glass Brain: it is the observability layer for auditing what the agents decided.

The console, in one frame

The Glass Brain console during an active escalation: bed B7 deteriorating, two Tier-2 proposals awaiting charge-RN approval, the spoken commitment chain linked to live chart evidence.

An escalation in progress. Surveillance has flagged bed B7 ahead of the alarm threshold; a rising creatinine has activated the spoken commitment to review blood-pressure medicines; both proposals wait at Tier 2 for the charge nurse. Every card carries its evidence. All patients synthetic.

Why inpatient nursing

Two failures define the general ward, and Relay attacks both:

The failure What Relay does about it
Deterioration is a slope, not a threshold. Most patients who arrest showed observable decline hours earlier; threshold-based scores fire late by design. Trend-based surveillance that flags deterioration ahead of the alarm threshold.
Promises expire silently. Nurses spend a large fraction of every shift feeding documentation systems, and commitments spoken at the bedside vanish into them. Conversation-derived task tracking with owners, schedules, and triggers, checked against the live chart.

The economics follow the same two failures. Nursing is the hospital's largest labor line, and its most expensive operational outcomes map directly to Relay's levers:

  • failure-to-rescue events → earlier escalation
  • expired bedside promises → kept commitments
  • unbalanced assignments → acuity-balanced staffing
  • stalled discharges → barriers that re-forecast as evidence moves

Why now.

  • Ambient clinical documentation is now mainstream hospital procurement: the bedside conversation is already captured and transcribed at scale.
  • That wave created the raw material and stopped at the note. Relay is the layer that operationalizes it.
  • The missing piece for deploying agents in a regulated setting is not model capability but the trust architecture around it, which is what this codebase is.

The wedge.

  • Land: one unit at a time. One console, one charge nurse, layered on existing systems with no workflow rip-and-replace.
  • Expand: horizontally across units, then upward, because cross-unit staffing and hospital-wide throughput are the same ontology, gate, and approval mechanics at larger scope.

Relay proposes nursing actions and escalations only. It never diagnoses, prescribes, or enters provider orders.

A promise becomes an operational object

The commitment lifecycle: a quote spoken at the bedside becomes a commitment with an owner, schedule, and trigger; evidence is checked against the live chart; the deterministic gate tiers the proposal; a human approves; the audit trail records everything.

  1. Quote. A sentence is spoken during admission and captured in the transcript.
  2. Commitment. It is extracted into an operational object: an owner, a schedule, a trigger.
  3. Evidence. From that moment it is checked against the patient's live chart.
  4. Gate. When evidence and commitment intersect, an agent raises a proposal; the deterministic gate assigns an approval tier or blocks it.
  5. Approval. A licensed human disposes.
  6. Audit. The trail records the whole chain, quote to signature.

Six agents

The six agents: Surveillance watches deterioration trends; Workflow watches commitment schedules and medication timing; Coordination handles cross-role actions; Staffing balances acuity-weighted assignments; Discharge tracks barriers and readiness; the Orchestrator arbitrates, ranks, and produces the huddle plan and SBAR.

On every mutation of unit state, all six agents re-evaluate the unit. They propose; they cannot act. Each agent is a pure function over a snapshot of the ontology: same state in, same conclusions out, which is what makes the replay tests possible.

Surveillance: trend, not threshold

  • Scores every vitals sample with a NEWS2-style partial early-warning score (respiratory rate, SpO2, temperature, systolic blood pressure, heart rate, supplemental oxygen).
  • Fits least-squares slopes over a trailing three-hour window and combines them into a single deterioration index.
  • Trend watch fires at index 1.5 with score 4+, hours before the alarm threshold of 8. Rapid-response escalation fires at score 8, or at index 3 with score 6.
  • Refuses to conclude anything from fewer than six samples spanning ninety minutes; repeat crossings while an escalation is pending are suppressed and recorded as suppressed.

Workflow: the commitment lifecycle

  • Scheduled commitments transition on evidence: a daily-0600 lab commitment is marked done when the morning results actually appear in the chart; an each-shift commitment becomes due at 09:00 and overdue at 11:00. Every transition is audited.
  • Triggered commitments arm on their spoken condition: consecutive creatinine draws rising by 0.1 mg/dL or more activate the renal medication review promise, and Workflow proposes holding the next dose pending provider review, citing both the lab pair and the original quote.

Coordination: close the loop across roles

  • When an escalation or medication hold is approved, proposes paging the accountable roles: provider, pharmacy, case management.
  • Folds related communication commitments (the promised family update) into the evidence.
  • Coordinates each approval exactly once, keyed by proposal id.

Staffing: the assignment solver

  • Runs whenever a patient escalates. Load is acuity-weighted: +3 for one-to-one observation, +2 for an escalated patient.
  • Minimizes, in order: maximum nurse load, load spread across nurses, number of handoffs.
  • Two hard constraints: nurse-patient ratio caps and infusion-certification matching.
  • Emits the policy-compliant plan alongside an unconstrained comparison plan that the gate visibly blocks, so the cost of the constraints is inspectable. Every report includes before/after load spread and solve time.

Discharge: readiness as a forecast

  • Tracks each patient's discharge barriers and re-forecasts readiness when evidence moves.
  • The same creatinine rise that activates the medication review also worsens the acute kidney injury barrier and pushes the discharge estimate later.

Orchestrator: arbitration and the deliverables

  • Ranks the huddle by escalation bucket first, then early-warning score, then acuity within the bucket, with the evidence trail attached to every item.
  • Folds in the staffing report and drafts the per-patient SBAR from live vitals, labs, and commitments.

Beyond proposals, every rule that fires writes a decision record with the rule id and its evidence references, so the agent's reasoning is auditable even when no action was warranted.

The gate

Every proposal passes a deterministic, non-LLM policy gate: Tier 0 auto, Tier 1 notify, Tier 2 charge-RN approval, Tier 3 two-signer. Hard invariants (ratio caps, infusion-certification matching, med actions framed only as hold-pending-provider-review) block violating proposals outright with no override affordance.

The gate is deterministic code; no language model participates in it.

Tier Authority Example
Tier 0 Auto, logged Routine bookkeeping
Tier 1 Notify Role pages, provider notifications, care-plan updates
Tier 2 Charge-RN approval Rapid-response escalation, medication hold, assignment rebalance
Tier 3 Two signers High-consequence actions
Blocked No one Hard-invariant violations; no override affordance exists

Hard invariants block violating proposals outright, visibly, with the reason attached:

  • nurse-patient ratio caps,
  • infusion-certification matching,
  • medication actions framed only as hold pending provider review.

The interface renders no override affordance and the API refuses.

Architecture: NIGHTINGALE

The runtime (server/) has three strictly separated layers; the separation is the product claim:

Layer Responsibility
Ontology store The live state of the unit: patients, nurses, assignments, commitments, vitals and lab streams, proposals, audit. Mutated only by ingestion events and approved actions.
Agent engine On every mutation, the six agents evaluate the unit and raise proposals; the gate tiers or blocks; the executor applies only what passed both the gate and human approval.
Ingestion Data enters the ontology through an adapter interface. In this repository the adapter is Scenario Replay. In production it is an EHR/device feed (HL7v2/FHIR ADT, vitals telemetry, eMAR); the engine is unchanged by the swap.

The ontology store

The ontology is the single source of truth for the unit, held as one typed state tree:

  • Patients, each carrying conditions, home medications, allergies, acuity, discharge barriers, bed, and assigned nurse, plus their live derived state: current vitals, a trailing window of recent vitals and labs, the computed early-warning score and its trend direction, and a status of stable, watch, escalated, or recovering.
  • Nurses with their operational competencies: maximum safe patient ratio and infusion (drip) certification, the two facts the staffing constraints and the gate invariants are checked against.
  • Commitments, the conversation-derived promises: the verbatim quote, its kind, the owning role, a schedule or trigger, and a lifecycle status (active, due, overdue, done, escalated) whose every transition is written to the audit trail.
  • Proposals, decision records, alerts, and audit entries, the agents' entire output surface, plus the current huddle plan and SBAR draft.

Three disciplines make it trustworthy:

  1. One mutation surface. A small set of typed store methods, called only by ingestion and by the executor after gate and human approval. Agents receive deep-cloned snapshots and are physically unable to write.
  2. Total order. Every mutation bumps a monotonic sequence number; every proposal, decision, and audit entry is stamped with the sequence and sim-time at which it happened. The console polls cheaply, and everything the system ever did has one authoritative ordering.
  3. No stale derivations. Derived facts (the early-warning score, the trend) are recomputed at ingestion, never cached ahead of the data, so state can never disagree with the observations that produced it.

Language models are used in exactly three places, and their output is language, never action:

  • extracting commitments from admission transcripts,
  • narrating the huddle plan,
  • drafting the SBAR.

An LLM cannot touch the gate, the ontology, or the approval flow. Prewarmed outputs in data/cache/ serve as the default and the fallback; live regeneration is optional.

This separation is also the commercial thesis. In a regulated buyer, the trust architecture is what turns a capable AI product into a deployable one:

  • a deterministic gate no model output can cross,
  • human authority over every consequential action,
  • a totally ordered audit trail,
  • provenance-labeled facts.

And the ontology a deployment accumulates, the unit's commitments, decisions, and outcomes over time, is the durable asset.

Scenario Replay

You cannot develop or evaluate a unit-operations system against a live hospital, so Relay ships with a deterministic scenario layer: synthetic patient trajectories are injected into the runtime as timestamped observations, exactly as a live feed would deliver them. The agents cannot tell the difference: every detection in a replay emerges from the same rules that would run in production, and the test suite asserts this by replaying the stream and checking what the agents concluded.

Replay controls: play · pause · step · seek (fast-forwards through every intermediate sample) · reset.

The bundled scenario is an eight-bed medical-surgical census built from the synthetic-ambient-fhir-25 dataset (Abridge; fully synthetic patients): real synthetic charts, a real admission conversation, and a real recorded deterioration trajectory. Every fact in the census carries a provenance label, and the labels travel with the evidence trail:

Label Meaning
dataset Verbatim from the source record
derived Deterministically transformed, with the transform documented
synthetic Authored for the scenario

The replay is not the only way in. The same ingestion surface accepts live cases at runtime:

  • POST /api/patients admits a patient mid-run (bed and nurse assigned deterministically),
  • POST /api/patients/:id/vitals streams observations.

A case created this minute flows through the identical agent path as the bundled scenario, from first sample to escalation proposal.

Quickstart

npm ci
npm run build:data      # rebuild data/processed/unit.json from the raw dataset
npm run dev:server      # NIGHTINGALE runtime on :4601
npm run dev:web         # Glass Brain on :5173 (proxies /api to :4601)
npm test                # engine test suite, including the emergent-behavior replay tests

Optional, for live language generation: create .env at the repo root with ANTHROPIC_API_KEY=.... Without it, Relay runs at full quality on prewarmed outputs.

Clinical safety & governance

Is this clinical decision support or autonomous care?

Decision support, scoped to nursing operations. Relay detects, proposes, and routes for approval. It does not diagnose, prescribe, enter orders, or take any patient-facing action without a licensed human approving it.

Can the language model bypass the safety controls?

No, structurally. LLM output is confined to narrative text and extraction proposals. The gate is deterministic code; approval authority is human; the executor only applies actions that passed both.

What about missing or stale data?

Observations carry timestamps; trend evaluation requires a minimum sample window before it will conclude anything, and the agents do not interpolate through gaps. Insufficient evidence is a first-class state, not a guess.

Is the early-warning score NEWS2?

No, and Relay does not claim it is. It is a NEWS2-style partial score computed from the available fields (RR, SpO2, temperature, blood pressure, heart rate, supplemental oxygen); consciousness level is not measured. It is labeled accordingly in the interface.

How is alarm fatigue handled?

Trend watches require both a sustained slope and an elevated score; alerts deduplicate per patient; repeat crossings while an escalation is pending are suppressed and marked as such rather than re-alerting.

Where does patient data go?

Nowhere: everything in this repository is synthetic. In a production deployment, conversation-derived and chart data would remain inside the covered entity's environment, with vendor agreements governing any model API usage; nothing here is used for model training.

Who can approve what?

Tier 2 requires the charge nurse; Tier 3 requires a second signer. Blocked proposals cannot be approved by anyone; the interface renders no affordance and the API refuses.

Roadmap

  • Ingestion adapters for live sources: FHIR subscriptions/ADT, device telemetry, eMAR events, replacing Scenario Replay in place.
  • Ambient audio at the bedside as the upstream source for commitment extraction, building on the same transcript interface the current pipeline consumes.
  • Constraint-programming assignment solver as a service (the in-process solver's contracts are already isolated).
  • Voice-first interaction for the huddle and escalation flows; the Glass Brain remains the audit surface.
  • Beyond the single unit: cross-unit staffing and hospital-wide throughput, which are the same ontology, gate, and approval mechanics at larger scope.

Repository layout

shared/   TypeScript contracts shared by runtime and console
server/   NIGHTINGALE runtime: ontology, agents, gate, executor, Scenario Replay, REST API
web/      Glass Brain observability console (Vite + React)
data/     raw dataset (synthetic), census pipeline, processed fixtures, prewarmed outputs

RELAY · UNIT OPERATIONS · LLMS PROPOSE · THE GATE DISPOSES · A NURSE DECIDES

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages