Prevent the diagnostic harm that begins the moment a follow-up falls silent.
LoopGuard Passport is a governed clinical safety MCP server and Prompt Opinion MCP App for care-continuity risk. It reads patient-scoped FHIR R4 context, detects explicit and implicit unresolved follow-up loops, enriches them with HPO phenotype flags, classifies urgency against published clinical guidelines, synthesizes compound risk across all open loops, renders a visual Passport dashboard, and saves review-required coordination artifacts back to the patient record as FHIR Task and DocumentReference resources.
Built for the Agents Assemble Healthcare AI hackathon on Prompt Opinion, May 2026.
A patient leaves the clinic with a positive FIT test. The clinician documents: "needs colonoscopy." Weeks become months. The referral was never scheduled. The patient was never called. The finding sits buried across notes, orders, tasks, and follow-up plans.
LoopGuard is designed to help prevent this workflow failure. It finds open loops that already fell silent, ranks the dangerous ones by guideline-grounded urgency, suppresses completed work, and saves a governed, review-required Passport back into the patient FHIR record so the next clinician can see what needs attention.
LoopGuard runs a full loop-closure pipeline:
- Reads patient-scoped FHIR R4 context from Prompt Opinion or synthetic demo data.
- Extracts implicit care commitments from clinical note narratives.
- Detects structured loops from FHIR resources.
- Suppresses completed loops so closed work is not re-alerted.
- Enriches open loops with HPO phenotype flags.
- Classifies urgency with guideline-grounded temporal zones.
- Ranks the open-loop board.
- Synthesizes compound risk across all open loops.
- Detects notification, ownership, and timeframe gaps from narrative text.
- Renders a visual Passport dashboard inside Prompt Opinion.
- Saves safe draft coordination edits as FHIR Task and DocumentReference resources when editing is enabled.
The default demo uses Maria Lopez, a fully synthetic patient with no real PHI.
| Loop | Urgency | Temporal status |
|---|---|---|
| Positive FIT -> colonoscopy | HIGH | RED - 200 days open, 180-day benchmark, 20 days over |
| Pulmonary nodule -> follow-up CT | MEDIUM | YELLOW - 240 days open, Fleischner Society 2017 |
| Diabetes A1C recheck | LOW | YELLOW - 120 days open, ADA Standards of Care 2024 |
| Abnormal potassium | SUPPRESSED | Completed Task - not re-flagged |
HPO phenotype flags include HP:0001903 Anemia, HP:0003281
Iron-deficiency anemia, HP:0001824 Weight loss, HP:0034307
Positive fecal immunochemical test, HP:0033660 Pulmonary nodule,
and HP:0000819 Diabetes mellitus.
Expected compound risk: ESCALATE_TODAY.
LoopGuard separates the parts of clinical AI that must be exact from the parts that benefit from language reasoning.
The MCP server is the deterministic clinical evidence engine: it parses FHIR, suppresses completed loops, maps HPO phenotypes, computes temporal urgency, detects narrative gaps, and emits review-required FHIR artifacts. A Prompt Opinion agent can sit on top as the generative reasoning layer: it reads raw evidence fields such as HPO terms, temporal zones, guideline sources, days-open values, missing information, and suppressed loops, then drafts a concise compound-risk synthesis for clinician review.
LoopGuard's differentiator is the combination of:
- implicit loop detection from unstructured notes
- structured FHIR loop detection
- completed-loop suppression
- HPO phenotype enrichment
- guideline-grounded temporal urgency
- cross-loop compound risk synthesis
- governed FHIR write-back as Task and DocumentReference
- visual Passport dashboard with editable draft fields
- strict human-in-the-loop safety
Exact-phrase searches across EuropePMC, arXiv, GitHub, and open-source repositories for "compound care gap synthesis," "multi-loop clinical risk prioritization," and "cross-loop urgency synthesis FHIR" returned zero results.
Default public surface:
Prompt Opinion requires tool names to match ^[a-zA-Z0-9_-]+$, so the public
MCP tools intentionally use flat names without dots.
| Tool | Purpose |
|---|---|
analyze_patient_loops |
Main structured pipeline output. Use demo_mode=true for the synthetic demo and demo_mode=false for live Prompt Opinion FHIR context. |
open_passport_app |
Visual Passport dashboard using the same pipeline output. |
debug_fhir_query_patterns |
Redacted FHIR diagnostic for Prompt Opinion patient context. |
Optional tools:
| Tool | Enable with | Purpose |
|---|---|---|
cohort_scan |
LOOPGUARD_ENABLE_COHORT_TOOL=true |
Synthetic panel triage across bundled demo patients. It does not enumerate a live workspace or group. |
Internal pipeline tools remain hidden by default. Enable them only for local
development with LOOPGUARD_EXPOSE_INTERNAL_TOOLS=true.
- Deploy the server and add the
/mcpendpoint in Prompt Opinion. - Grant patient-scoped read scopes.
patient/Patient.rsis required. - For live FHIR testing, select a patient and call
debug_fhir_query_patterns. - If diagnostics pass, call
analyze_patient_loopswithdemo_mode=false. - Re-add the MCP server after changing scopes or environment flags so Prompt Opinion refreshes tool metadata.
Prompt Opinion FHIR context is read from request headers:
X-FHIR-Server-URL
X-FHIR-Access-Token
X-Patient-ID
Tokens are never returned in tool output.
The Passport dashboard is read-only by default. To enable safe draft-edit controls, set:
LOOPGUARD_ENABLE_PASSPORT_EDITING=true
Editable fields are limited to coordination metadata:
draft_next_action
owner_display
due_date
review_status
clinician_note
suppress_reason
escalation_status
Diagnosis, medication, procedure order, prescription, and patient-message fields are rejected. LoopGuard does not diagnose, prescribe, place orders, schedule procedures, or contact patients.
When live FHIR write context is available, SaveLoopDraftEdit persists:
Task: draft/proposed coordination work item
DocumentReference: current LoopGuard Passport snapshot
Provenance: attempted when supported; audit context is also embedded in the document
Required write-capable scopes when editing is enabled:
patient/Task.cu
patient/DocumentReference.cu
patient/Provenance.cu
Common flags:
LOOPGUARD_ENABLE_DEBUG_TOOL=true
LOOPGUARD_ENABLE_COHORT_TOOL=false
LOOPGUARD_ENABLE_PASSPORT_EDITING=false
LOOPGUARD_EXPOSE_FLAT_ALIASES=false
LOOPGUARD_EXPOSE_INTERNAL_TOOLS=false
LOOPGUARD_USE_PREFAB_RENDERER_PATCH=false
PORT=8000
pip install -r requirements.txt
python loopguard_server.pyHealth check:
GET /health
MCP endpoint:
POST /mcp
python smoke_test.pyExpected result: all checks pass.
Stable demo:
Call analyze_patient_loops with demo_mode=true.
Visual dashboard:
Open the LoopGuard Passport dashboard for the synthetic demo patient using open_passport_app with demo_mode=true.
Live FHIR diagnostic:
Call debug_fhir_query_patterns for the current Prompt Opinion patient context. Summarize header presence, query status, and redaction status. Do not print any access token.
Live FHIR analysis:
Call analyze_patient_loops with demo_mode=false for the current Prompt Opinion patient. Return data_mode, review_required, warnings, open loop count, suppressed loop count, compound risk level, and a fresh synthesis from raw evidence. Do not expose tokens or FHIR headers.
Optional synthetic cohort:
Call cohort_scan with demo_mode=true. Summarize total_patients, patients_with_red_loops, total_open_loops, escalation_queue, review_required, and safety_note.
All outputs are draft care-coordination support and require responsible clinician review. LoopGuard does not diagnose, prescribe, place orders, schedule procedures, or contact patients autonomously. The demo uses synthetic patient data only, and no real PHI is required for judging.
Editable Passport fields are restricted to safe coordination-only content. Diagnosis fields, medication fields, procedure orders, and patient-facing messages are never exposed for editing. Access tokens are never printed in outputs.
- Prompt Opinion marketplace/share URL: https://app.promptopinion.ai/marketplace/mcp/019e06c7-215c-7f45-b79d-421649799f67
- Deployed MCP URL: https://loopguard-passport.onrender.com/mcp
- GitHub URL: https://github.com/BoBbY-dev-0099/loopguard-passport
- Singh et al., BMJ Quality & Safety, 2014: pubmed.ncbi.nlm.nih.gov/24742777/
- Callen et al., JGIM, 2012: pubmed.ncbi.nlm.nih.gov/22183961/
- Singh et al., Arch Intern Med, 2009: pubmed.ncbi.nlm.nih.gov/19786677/
- Corley et al., JAMA, 2017: pubmed.ncbi.nlm.nih.gov/28444278/
- Kern et al., BMC Health Services Research, 2024: pubmed.ncbi.nlm.nih.gov/39256705/
- Steele et al., Scientific Reports, 2024: pubmed.ncbi.nlm.nih.gov/39085317/
- Danforth et al., Am J Kidney Dis, 2019: pubmed.ncbi.nlm.nih.gov/31324445/
- O'Connor et al., Appl Clin Inform, 2018: pubmed.ncbi.nlm.nih.gov/29874687/
- Aoki et al., BMJ Open, 2020: pubmed.ncbi.nlm.nih.gov/32819954/
- Dong et al., Orphanet J Rare Dis, 2020: pubmed.ncbi.nlm.nih.gov/33115515/
- Amat et al., Jt Comm J Qual Patient Saf, 2024: pubmed.ncbi.nlm.nih.gov/37996308/
- Reuland et al., JAMA Netw Open, 2024: pubmed.ncbi.nlm.nih.gov/39585696/
LoopGuard does not find problems. It prevents the moment a missed cancer begins -- the silent follow-up that nobody tracked.