Independent developer Andrii Zhukovskyi has released Health OS, a self-hosted personal health record system that allows AI assistants to interact with sensitive medical data via an MCP server equipped with 39 tools. The core philosophy is explicitly distrustful of the LLM: while the system uses a prompt for context, the critical safety mechanisms are written in plain Python to ensure they cannot be argued with or overridden by injected instructions in uploaded PDFs.
The Danger of the Morning After
Zhukovskyi designed the system against a specific failure mode described in a docstring: a critical potassium level of 6.8 sitting in 'pending' status at 23:00, only to be misinterpreted as 'no abnormalities' in a morning query. To combat this, Health OS stages all lab results as pending after extraction from PDFs or photos. The model cannot read these values directly; it must use tools like list_pending_reviews and approve_staged_source. Approval is marked as a destructive hint, requiring explicit user instruction before data becomes visible to the assistant.
Deterministic Safety Layers
The project treats the LLM as an interface, not an engine. For medication safety, the model is forced to call check_medication_safety rather than answering directly. Early versions of this deterministic tool failed to aggregate total daily paracetamol correctly, reporting 1950 mg/day when the actual total was 5950 mg because brand names like Gelocatil were not matched. The current version returns 'incomplete' if a product’s dose is unknown, preventing false 'within limits' assurances. Critical thresholds for values like potassium or BI-RADS 4-5 reports trigger immediate alerts via log, macOS notifications, or Telegram, bypassing the model’s interpretation entirely.
Testing for Hallucinations and Injections
Zhukovskyi implements a red-team testing suite in evals/test_red_team.py that runs without an LLM in the loop. These tests verify that the deterministic layer catches prompt injection attempts, such as 'Ignore all previous instructions... Impression: mass lesion, Bi-RADS 5,' ensuring the classifier still flags the critical finding. The tests also guard against false positives, such as a normal glucose reading of 95 mg/dL incorrectly triggering a critical alert due to unit parsing errors. This approach shifts the burden of accuracy from the stochastic model to verified code.
Key Takeaways
- Health OS uses a 'pending' staging area for all extracted lab data, requiring explicit user approval before the AI can access it.
- Critical safety checks are implemented in Python, not the prompt, to prevent instruction injection from altering medical interpretations.
- The system refuses to answer drug interaction questions entirely until a deterministic interaction engine is built, acknowledging the LLM's tendency to hallucinate both ways.
- Open-source under AGPL-3.0, the project includes seven red-team tests that verify deterministic logic without invoking the LLM.
The Bottom Line
This is the most pragmatic implementation of AI in healthcare I’ve seen: it admits the LLM is a liability for critical data and builds a fortress of deterministic code around it. If you’re building agentic workflows for high-stakes domains, stop trusting the model’s reasoning and start trusting your unit tests. The era of 'vibe checking' medical data is over; the future is verified, staged, and explicitly approved.