Build a 100% Local Family Medical Companion on Mac with Google MedGemma 2 A developer built KinDesk, a 100% local family medical companion for macOS that runs Google MedGemma 2 (medgemma2:26b-mlx-bf16 via local Ollama) entirely on-device, keeping per-member health vaults bound to 127.0.0.1 with 0700/0600 permissions and zero bytes sent to the cloud. The system ingests password-protected lab PDFs in memory with PyMuPDF, maps biomarkers to 88 verified LOINC codes, exports HL7 FHIR R4 bundles, and combines MedGemma 2 vision with 4 server-bound tools, a 0 ms negation-aware emergency guardrail, and a two-layer AST plus macOS Seatbelt sandbox (0 net · 0 FS). The write-up sizes the model for Apple Silicon at 12 GB for the E4B edge build, 24–32 GB for 26B Q4, or 64–128 GB for 26b-mlx-bf16, and presents chapters 2–7 as architecture guidance and skeletons of 40 lines or fewer rather than full production source. What You Will Build & Master - Size Google MedGemma 2 cleanly for Apple Silicon 12 GB E4B edge, 24–32 GB 26B Q4, or 64–128 GB 26b-mlx-bf16 bound strictly to 127.0.0.1 with 0700/0600 vault perms, .metadata never index Spotlight exclusion, and zero-packet scutil --nwi checks. - Ingest password-protected diagnostic lab PDFs strictly in memory with PyMuPDF, map biomarkers deterministically to 88 verified LOINC codes & unit conversions, detect cross-member mismatches, and export spec-valid HL7 FHIR R4 bundles. - Combine MedGemma 2 multimodal vision <|think| traces + EXIF/HEIC normalization with 4 server-bound tools never passing member id to the LLM , a 0 ms negation-aware emergency guardrail, and a two-layer AST + macOS Seatbelt sandbox 0 net · 0 FS . - Wrap the adaptive dark/light React 19 UI System Dark default + Light/Dark toggle, X-KinDesk-Token Blob images, fetch SSE, and light-paper 1-Page Doctor Visit Brief PDF inside a standalone Swift 5 WKWebView app wiring all 6 mandatory macOS delegates. Table of Contents 7 Chapters All UnlockedCh. 1 Free Architecture, Safety & Agent-Build Blueprint: Rather than dumping full production source files, Chapters 2 through 7 give you the local-first privacy architecture, hardware sizing, compact Python/TypeScript/Swift interface skeletons <= 40 lines each , forensic macOS & Ollama fixes, HAI-DEF licensing boundaries, and a Master Coding-Agent Prompt to build your own local family companion. 1. Architecture, Privacy Guarantees & Apple Silicon Hardware Sizing Keeping track of a household's medical history usually turns into a fragmented paper chase: one partner's annual blood panel is buried in a password-protected PDF in Gmail, another's chest X-ray or 12-lead ECG strip lives in a phone gallery, prescriptions are scattered across messaging threads, and preparing a clear summary of changes before a 10-minute clinic visit takes an hour of manual spreadsheet juggling. Uploading those intimate family health records into a third-party cloud chatbot is a privacy non-starter. Instead, I built KinDesk , a calm, high-craft 100% local Family Medical Companion for macOS powered by Google MedGemma 2 medgemma2:26b-mlx-bf16 via local Ollama . A household keeps isolated per-member vaults Ashutosh , Sharon , plus unlimited added relatives via + Add right on the Mac, switches seamlessly between Warm Botanical-Espresso Dark Mode System Dark default and Warm Paper-Linen Light Mode, extracts encrypted lab PDFs into longitudinal markers and HL7 FHIR R4 bundles, inspects medical scans with MedGemma 2 vision + reasoning traces, runs peer-reviewed clinical calculators and macOS Seatbelt-sandboxed Python math 0 net · 0 FS , and exports a crisp light-paper 1-Page Doctor Visit Brief PDF with Wi-Fi switched off and zero bytes sent to the cloud. How This Blueprint Works: Rather than dumping thousands of lines of brittle production source code, Chapters 2 through 7 give you the complete local-first architecture, Apple Silicon hardware sizing, short illustrative Python, TypeScript, and Swift skeletons <= 40 lines each , macOS security invariants, a 12-row forensic troubleshooting matrix, HAI-DEF licensing & clinical oversight boundaries, and a Master Coding-Agent Blueprint Prompt so you can build and tailor your own local companion. End-to-End 6-Stage Local Family Health Pipeline Why a 3-Layer Local Architecture Dual-Mode Calm UI + Loopback Vault + Thin Native Shell 1. Layer 1: Dual-Mode Botanical React 19 + TypeScript UI Zero External CDNs : - Medical tools feel stressful when dressed like loud, high-alert trading terminals. KinDesk ships an adaptive dual-mode system using CSS color-scheme: light dark and light-dark : Warm Botanical-Espresso Dark Mode 0E110F backdrop, 151917 canvas, 1D221F cards, 63B99E botanical sage, F1EDE5 warm cream ink as the System Dark default, paired with a 1-click Warm Paper-Linen Light Mode EFECE6 / FAF8F4 / FFFFFF / 2D6A5B , native macOS ui-serif editorial headings, soft biomarker range bars, and strictly three focused views: Overview , Reports & Scans , and Ask KinDesk . - Every font, icon, stylesheet, and asset ships locally inside the Vite bundle zero Google Fonts, zero analytics pixels, zero remote CDNs , and the 1-Page Doctor Visit Brief always locks to clean light paper on export regardless of the active UI theme. 2. Medical tools feel stressful when dressed like loud, high-alert trading terminals. KinDesk ships an adaptive dual-mode system using CSS 3. Layer 2: Hardened Local Python FastAPI + SQLite FTS5 Vault 127.0.0.1 Only : - Bound strictly to loopback 127.0.0.1: