文件 stable ID、雜湊、時間範圍、去識別狀態。
多來源臨床推理的可追溯基礎設施
讓臨床推理
可以被檢查。
把多份臨床紀錄整理成有來源依據的鑑別診斷、系統 RCA, 以及可由合格人員複核的標準化審查包。
Engineering alpha · 非醫療器材 · 需要合格人員審查
一個案例,一本可追溯帳本。
RootCause MCP 不是診斷模型。它讓不同 Agent 以同一份 session、同一組來源契約和同一套 產物格式工作,並保存每個推論輸入、反證、限制與核准狀態。
逐字片段、來源位置、事件時間與驗證方法。
依 syndrome framework 逐格審查,建立最大合理 DDx;三項只是 finalization floor。
Fishbone、5-Why、HFACS 與保守因果稽核。
先預覽、再核准;保留 reviewer 與內容雜湊。
思考發生在 Agent;約束與稽核發生在 MCP。
一份合規格的產物來自清楚的責任交接,不是把 raw records 丟給 MCP 後期待它自行判讀。
Host/核准的 extractor
讀取 raw PDF、DOCX、影像或 EHR,輸出原子文字、頁碼/行號、雜湊與時間精度。
Reasoning Agent
依 phenotype/time course 展開機轉,逐格稽核 DDx,並提出 source-linked 支持、反證、unknown 與 discriminator。
RootCause MCP
檢查 schema、來源血緣、evidence relation、狀態轉移、readiness gates 與標準化輸出。
合格人類審查者
複核來源、醫學合理性、因果用語與改善措施,決定是否核准最終快照。
標準產物不是一段結論,而是一組可查核關係。
同一份案例可輸出 JSON、Markdown 與 FHIR DiagnosticReport;canonical JSON 是交接基準。
Built-in Markdown 使用 locale=zh-TW、audience=clinician 時,
說明文字為繁中,diagnosis/test/drug/procedure 名稱保留 English。
來源與時間軸
append-only source review/independence、文件 hash、typed time、precision 與跨來源衝突;unknown time 不會被假排序。
證據與鑑別診斷
逐筆 provenance、framework breadth audit、明確選定 leading、source-calibrated LR、支持/反證/neutral、unknown、discriminating test、certainty 與 must-not-miss disposition。
系統 RCA
Fishbone、5-Why、逐 cause authorized HFACS review 與 causation audit;稽核狀態不等於因果證明。
限制、readiness 與審查
未解缺口、認知偏誤、核准者、核准範圍、finalization blocker 與內容雜湊。
{
"source_inventory": [
{
"document": "SRC-001",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"evidence_count": 3,
"verified_count": 3,
"coverage_status": "reviewed",
"de_identified": true,
"independence_status": "independent",
"source_group_id": "SRC-GROUP-001",
"source_review_adjudication_id": "SRV-001",
"source_reviewed_by": "authorized-reviewer",
"source_reviewed_at": "2026-08-18T09:00:00Z",
"source_review_reason": "Source lineage reviewed"
}
],
"hypotheses": [
{
"id": "HYP-001",
"diagnosis": {"display": "Candidate A"},
"mechanism_category": "VASCULAR",
"diagnostic_role": "ETIOLOGIC",
"certainty": "POSSIBLE",
"reasoning_basis": "MECHANISM_INFERENCE",
"must_not_miss": false,
"supporting_evidence_ids": ["EVD-001"],
"contradicting_evidence_ids": ["EVD-004"],
"planned_tests": [],
"status": "ACTIVE",
"clinical_rationale": "Auditable rationale for Candidate A"
},
{
"id": "HYP-002",
"diagnosis": {"display": "Candidate B"},
"mechanism_category": "DRUG_TOXIN_IATROGENIC",
"diagnostic_role": "MIMIC",
"certainty": "POSSIBLE",
"reasoning_basis": "MECHANISM_INFERENCE",
"must_not_miss": false,
"supporting_evidence_ids": ["EVD-002"],
"contradicting_evidence_ids": ["EVD-005"],
"planned_tests": [],
"status": "ACTIVE",
"clinical_rationale": "Auditable rationale for Candidate B"
},
{
"id": "HYP-003",
"diagnosis": {"display": "Must-not-miss C"},
"mechanism_category": "VASCULAR",
"diagnostic_role": "ETIOLOGIC",
"certainty": "UNKNOWN",
"reasoning_basis": "MECHANISM_INFERENCE",
"must_not_miss": true,
"supporting_evidence_ids": ["EVD-003"],
"contradicting_evidence_ids": [],
"planned_tests": [{
"test_id": "TST-001",
"name": "Definitive local diagnostic study",
"purpose": "RULE_OUT",
"target_hypothesis_id": "HYP-003",
"expected_supporting_result": "Predefined positive pattern",
"expected_refuting_result": "Predefined adequate negative pattern",
"status": "PLANNED"
}],
"status": "ACTIVE",
"clinical_rationale": "Must-not-miss until ruled out"
}
],
"leading_hypothesis_id": "HYP-001",
"root_causes": [{
"id": "WHY-003",
"answer": "Escalation trigger absent",
"evidence": ["EVD-006"],
"causation_verification_id": "AUDIT-001",
"causation_result": "INSUFFICIENT_DATA",
"disposition": "PROPOSED"
}],
"causation_verifications": [{
"verification_id": "AUDIT-001",
"cause_event": {"id": "WHY-003", "description": "Escalation trigger absent", "evidence": ["EVD-006"]},
"effect_event": {"description": "Escalation was delayed", "evidence": ["EVD-007"]},
"overall_result": "INSUFFICIENT_DATA",
"audit_scope": "CONSERVATIVE_CAUSATION_AUDIT",
"clinical_causality_established": false
}],
"conformance_checks": [{
"code": "ROOT_CAUSATION_AUDIT_LINEAGE",
"status": "PASS",
"severity": "HARD",
"message": "Root audit lineage is exact",
"refs": ["WHY-003"],
"details": {}
}],
"is_finalized": false,
"content_hash": null
}
把它當作 reasoning ledger,不是診斷模型。
MCP surface 接受結構化動作;application 層編排流程;domain 層保護醫學推理不變量; infrastructure 層保存 session 與匯出產物。
Interface → Application → Domain ← Infrastructure
Live contracts 是權威
不要從網站 copy 猜 schema。Agent 啟動後應先讀取 MCP resource:
clinical://contracts/case-input-manifestclinical://contracts/case-analysis-reporttools/list取得當前 tool schema
依情境選 tool profile
數字為 2.0.0a3 的發布快照;runtime 的 tools/list 優先。
P0 deterministic conformance
typed nested schema驗證穩定 section;報告附conformance_checks[]- 來源必須有 allowlisted append-only review、de-identification 與 independence lineage;相同 bytes 不算兩份獨立來源
- 只有 source-aware
instant可排序/支持 temporality;date/range/relative/unknown保留為 unpositioned - Root audit 的 ID、description、evidence 必須與 Why/evidence ledger 完全一致
REJECTED不得留在 root-cause bucket;INSUFFICIENT_DATA只能標為PROPOSED- 選 syndrome-appropriate framework;PRIMARY breadth audit 每一格都須 reviewed,不得留下
NOT_ASSESSED REVIEWED_INSUFFICIENT_DATA保留 unknowns 與 typed discriminators,不得當作排除- 至少三個不重複 DDx、兩種非
UNKNOWNmechanism 與適用的 must-not-miss 只是 finalization floors;每個 active DDx 都要有 rationale、uncertainty 與 genuine evidence 或 typed test disposition - Leading 必須明確選定;Leading 與每個 must-not-miss 都要有真正支持,以及反證或 typed planned test
- 非中性 LR 必須連到另一筆 verified
LITERATUREcalibration evidence;每個 Fishbone cause 需要 authorized HFACS review - final 必須有 authorized reviewer、時間與可重算 hash;完成後是 immutable final snapshot
- 76/76 targeted hard-mutation regressions 均阻擋 unsafe finalization
Engineering alpha 的 deterministic P0 已通過;Agent MVP 尚未建立。
Contract 與 targeted regressions 能證明不合規的報告不能 finalize;公開案例與 runner 只供工程驗證。 它們不能證明未知案例中的 DDx 或 root cause 正確,也不能取代正式盲評。
| 驗證層 | 目前狀態 | 能證明什麼 |
|---|---|---|
| Engineering-alpha deterministic P0 | 已通過 | Typed nested report schema、machine-readable conformance_checks[] 與 76/76 targeted hard-mutation regressions。 |
| Native multi-source MCP flow | 已通過 | 多來源 manifest、exact provenance、DDx、RCA、approval gate 與統一報告。 |
| Public 6-case corpus/runner | Engineering reference | 去除檔名、診斷與 LR 洩漏的公開案例、公開 rubric 與 runner scaffold;公開 gold 不能構成盲評。 |
| Formal cross-Agent evaluation | NOT_ESTABLISHED | 仍需 3 runtimes × 6 cases × 2 repeats = 36 runs、repo-external private corpus、private holdout gold、乾淨 data root 與 trusted server trace。 |
| Two-clinician blinded review | NOT_ESTABLISHED | 仍需兩名臨床 reviewer 盲評 DDx、must-not-miss、RCA 與因果措辭,並 adjudicate 分歧。 |
| Production security/governance | NOT_ESTABLISHED | 真實部署所需的身分、授權、多租戶、加密、稽核與 retention 控制。 |
Finalized 代表「通過 deterministic gates、由 authorized reviewer 核准、附時間與可重算 hash 的 immutable final snapshot」, 不代表診斷已獲臨床證實,也不代表因果關係成立。 重新載入 final JSON 時仍須由 operator 提供 reviewer allowlist;SHA-256 可偵測內容變更,但不是 digital signature。
Engineering alpha 現在可以宣稱
- typed nested contract 與 fail-closed finalization
- 完整 source-review ledger 與由 ledger 重算的 final inventory projection
- root/Why/evidence/audit lineage 與安全 disposition
- syndrome framework 逐格 breadth audit 與 typed DDx disposition;三項只是 finalization floor
- 公開 6-case corpus/rubric/runner 可作工程 reference
Formal Agent MVP:NOT_ESTABLISHED
- repo-external private corpus 與 private holdout gold
- 可信 runtime/MCP server trace 與 36-run matrix
- 兩名臨床 reviewer 的 blinded scoring 與 adjudication
- PHI/IAM/audit/retention 控制
五分鐘啟動工程試跑。
先使用 synthetic 或已去識別資料。不要把 GitHub、CI 或公開 Pages 當作臨床資料安全區。
- 安裝鎖定環境同步 runtime、dev 與測試依賴。
- 以 condensed profile 啟動讓 Agent 先看到 8 個 facade tools。
- 讀取 live contracts再建立 session 與來源 manifest。
- PRELIMINARY first先預覽 blockers;合格人員複核後再 finalize。
- Remote host 要另外驗證在實際 Agent/extension host 執行 MCP doctor。
# 1. Install the locked environment
uv sync --all-extras --all-groups --locked
# 2. Start the MCP server over stdio
ROOTCAUSE_TOOL_PROFILE=condensed uv run --locked rootcause-mcp
# 3. Verify both VS Code and Copilot configs on this host
uv run --locked python scripts/mcp_doctor.py --config all
# 4. The client should read these live resources first
clinical://contracts/case-input-manifest
clinical://contracts/case-analysis-report
安全邊界要比功能清單更早被看見。
這是 engineering alpha。公開 repo、CI 與 GitHub Pages 都不是用來接收或保存真實病歷的環境。
目前內建
- 來源 stable ID、SHA-256、snippet 與 location 驗證
- 資料路徑與 checkpoint confinement
- DDx、反證、衝突、readiness 與核准 gates
- PRELIMINARY/final 狀態與 content hash
- JSON、Markdown、FHIR DiagnosticReport 輸出
尚未內建/不能宣稱
- raw PDF、DOCX、影像或 EHR 的內建抽取器
- 身分驗證、RBAC、多租戶隔離、at-rest encryption、retention enforcement
- Agent 臨床能力、輸出完全正確或法規合規保證
- causation audit 對臨床因果的證明
- 未經人類複核即可直接用於照護決策