Inspiration

A doctor prescribes a drug that could kill a patient. He doesn't know the patient is on a contraindicated medication from another provider. Sarah Mitchell — 67yo, four providers, no shared records — is a real-life pattern that kills 7,000+ Americans every year from preventable drug interactions. We built ClinicalMem to be the persistent memory layer those providers don't have, with FDA-grade auditability so a regulator can replay every decision a decade from now.

What it does

Persistent, auditable, contradiction-safe clinical memory for healthcare AI agents. Ingests FHIR R4 patient data, runs every drug-pair through a 6-layer safety pipeline (deterministic table → OpenEvidence → RxNorm → multi-LLM consensus → LLM synthesis → abstention), emits findings cryptographically pinned in a SHA-256 Merkle audit chain. PHI never leaves a site — only de-identified clinical knowledge crosses provider boundaries via 21 typed runtime federation invariants enforced by the MIND compiler. Curated rule packs cited inline: DDInter 2.0, AGS Beers Criteria 2023, FDA boxed warnings, CDC ACIP vaccine guidance, PubMed evidence (RCTs / systematic reviews / guidelines).

How we built it

ClinicalMem v4.1.0. Path B BitNet b1.58 ensemble: bundle A (50,949 ternary params, 118 KB, contra/major gate) cascades to bundle B (12,741 ternary params, 30 KB, moderate/serious/major specialist). 100% recall on 139-pair PCCP cohort: 44/44 contraindicated · 4/4 major · 69/69 serious · 22/22 moderate · zero false positives. Federation enforced by JointMemoryFederation.flow.mind (X25519 sealing + Ed25519 signing + ChaCha20-Poly1305 AEAD). FastMCP 2.x server with 18 tools + Google ADK A2A agent with 5 skills · 13 tools, both on Azure Container Apps. Bit-identical Q16.16 fixed-point arithmetic — the in-browser BitNet replays the same forward pass byte-for-byte, under 1 ms on a $15 Raspberry Pi Zero 2. 1425 tests passing.

Challenges we ran into

Single-model BitNets cannot fit 4-class fine discrimination in a 193-dim feature space — three retrains (v9 / v10 / v11) regressed contraindicated recall by 3–8 anchors before we settled on the disjoint-specialist cascade. Cross-architecture determinism: any non-Q16.16 op breaks bit-identical replay across x86 / ARM / CUDA. HIPAA enforcement at compile time, not runtime: the 21 federation invariants had to be expressible in MIND's type system.

Accomplishments that we're proud of

FDA-grade Verify Replay: click in browser, your machine recomputes the exact server hash. 100% recall on every severity class with zero false positives in the contraindicated class. One ternary model under 150 KB that runs in <1 ms on a $15 Raspberry Pi Zero 2. Tamper-proof SHA-256 Merkle audit chain aligned with HIPAA § 164.312(b).

What we learned

"I don't know" saves lives. The abstention gate refuses to answer when evidence is insufficient — that's a feature, not a bug, in healthcare AI.

What's next for ClinicalMem

Live integration with EHR FHIR endpoints, deterministic-table expansion beyond cardiovascular and diabetes, native vaccine pathway via CDC ACIP, and FDA SaMD pre-submission for the Layer 4.5 ternary classifier.

Built With

  • a2a-protocol
  • azure-container-apps
  • bitnet
  • chacha20-poly1305
  • claude
  • clinicaltrials-gov-api
  • cloudflare-pages
  • docker
  • ed25519
  • fastapi
  • fastmcp
  • fhir
  • google-adk
  • google-gemini
  • grok
  • huggingface
  • mind-lang
  • mind-mem
  • openai-gpt-5.4
  • openevidence-api
  • openfda-api
  • perplexity
  • python
  • q16.16
  • rxnorm
  • sha-256
  • snomed-ct
  • umls
  • umls-metathesaurus
  • x25519
Share this project:

Updates

Submission history