Paper deep dive
Foundation Agents Meet Agentic Deep Research: Evidence-Grounded Clinical Code Forecasting
Junda Wang, Meysam Ghaffari, Akshat Choube, Mohsen Sharifi Renani, Hong Yu, Carlos Morato
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 96%
Last extracted: 8/19/2026, 4:13:58 AM
Summary
The paper introduces ICD-Deepresearch, a framework for next-encounter ICD code forecasting that combines structured EHR foundation models (SparseEHR) and language models (GPT-5) with an agentic Deep Research workflow. The system generates candidate codes via an EHR Prior and a Direct Forecast, then uses bounded research expansion rounds to retrieve and verify evidence from medical literature and ICD dictionaries. Final selection jointly ranks candidates, achieving improved precision/recall on MIMIC-III and MIMIC-IV datasets compared to standalone models and research systems.
Entities (7)
Relation Signals (6)
ICD-Deepresearch → evaluatedon → MIMIC-III
confidence 100% · ICD-Deepresearch achieves patient-averaged precision/recall of 24.60/35.09% on MIMIC-III
ICD-Deepresearch → evaluatedon → MIMIC-IV
confidence 100% · and 25.14/48.32% on MIMIC-IV.
ICD-Deepresearch → uses → SparseEHR
confidence 95% · Candidate Generation uses SparseEHR to produce an EHR Prior
ICD-Deepresearch → uses → GPT-5
confidence 95% · an independent GPT-5 Direct Forecast supplies complementary candidates.
SparseEHR → generates → EHR Prior
confidence 90% · Candidate Generation uses SparseEHR to produce an EHR Prior
ICD-Deepresearch → outperforms → Medical Deep Research
confidence 90% · ICD-Deepresearch therefore improves over the registered local comparators while retrieving evidence with higher physician-rated usefulness than the standalone research systems
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Next-encounter ICD forecasting predicts which standardized diagnosis codes will be documented at a future visit from the longitudinal record available beforehand. The task is prospective and multi-label: the target note does not yet exist, and several codes may be correct. Structured EHR foundation models capture recurrence and temporal progression, whereas language foundation models generate flexible diagnostic hypotheses. We introduce ICD-Deepresearch, a DeepResearch workflow that composes these predictive foundation models with medical search and ICD dictionaries. Because no source reveals the future code set, research evaluates candidate transitions by linking patient evidence, external clinical relations, and exact code semantics under a fixed top-K budget. Candidate Generation uses SparseEHR to produce an EHR Prior that initializes two bounded Research Expansion rounds; an independent GPT-5 Direct Forecast supplies complementary candidates. Final Selection validates, deduplicates, and jointly ranks both paths, after which a separate module writes rationales without changing predictions. Finally ICD-Deepresearch achieves patient-averaged precision/recall of 24.60/35.09% on MIMIC-III and 25.14/48.32% on MIMIC-IV. Physicians rate 51% and 68% of its retrieved documents useful, compared with 22% and 39% for standalone GPT-5 web search and 32% and 41% for Medical Deep Research. ICD-Deepresearch therefore improves over the registered local comparators while retrieving evidence with higher physician-rated usefulness than the standalone research systems
Tags
Links
- Source: https://arxiv.org/abs/2608.17075v1
- Canonical: https://arxiv.org/abs/2608.17075v1
Trouble viewing inline? Open PDF directly →
Full Text
217,566 characters extracted from source content.
Expand or collapse full text
Foundation Agents Meet Agentic Deep Research: Evidence-Grounded Clinical Code Forecasting Junda Wang 1 , Meysam Ghaffari 2 , Akshat Choube 2 , Mohsen Sharifi Renani 2 , Hong Yu 3 , Carlos Morato 2 1 University of Massachusetts Amherst, MA, USA 2 Optum, MN, USA 3 University of Massachusetts Lowell, MA, USA Abstract Next-encounter ICD forecasting predicts which standardized diagnosis codes will be documented at a future visit from the longitudinal record available beforehand. The task is prospec- tive and multi-label: the target note does not yet exist, and several codes may be correct. Structured EHR foundation models capture recurrence and temporal progression, whereas language foundation models generate flexible diagnostic hy- potheses. We introduce ICD-Deepresearch, a DeepResearch workflow that composes these predictive foundation mod- els with medical search and ICD dictionaries. Because no source reveals the future code set, research evaluates candi- date transitions by linking patient evidence, external clini- cal relations, and exact code semantics under a fixed top-K budget. Candidate Generation uses SparseEHR to produce an EHR Prior that initializes two bounded Research Expan- sion rounds; an independent GPT-5 Direct Forecast supplies complementary candidates. Final Selection validates, dedu- plicates, and jointly ranks both paths, after which a sepa- rate module writes rationales without changing predictions. Finally ICD-Deepresearch achieves patient-averaged preci- sion/recall of 24.60/35.09% on MIMIC-I and 25.14/48.32% on MIMIC-IV. Physicians rate 51% and 68% of its retrieved documents useful, compared with 22% and 39% for stan- dalone GPT-5 web search and 32% and 41% for Medical Deep Research. ICD-Deepresearch therefore improves over the registered local comparators while retrieving evidence with higher physician-rated usefulness than the standalone research systems 1 . 1 Introduction Electronic health records (EHRs) accumulate over clinic visits and hospital admissions. Each encounter records di- agnoses, tests, procedures, and treatments, so the resulting record describes a longitudinal trajectory rather than a sin- gle clinical state. Hospitals represent documented diagnoses using International Classification of Diseases (ICD) codes, standardized identifiers for morbidity classification, report- ing, and reimbursement (Centers for Medicare & Medicaid Services (U.S.) et al. 2025). We study next-encounter ICD forecasting: given a patient’s record through encounter t, rank the codes likely to be documented at encounter t+1 and return the top K. At prediction time, the model observes only information recorded through encounter t; it cannot 1 We will release our code upon acceptance. use anything that will arise during encounter t+1, includ- ing presenting symptoms, examination findings, new test re- sults, procedures, or clinician documentation. The target is the complete ICD code set documented at that encounter. It is prospective because the target lies beyond the observation window, and multi-label because one encounter may receive multiple diagnosis codes. The model must therefore project the observed patient trajectory into its next documented state. This prospective task benefits from two complementary foundation-model tools (Moor et al. 2023). Longitudinal EHR models learn recurrence and progression from patient trajectories, providing a patient-specific prior (Zhang et al. 2025; Kraljevic et al. 2024; Fallahpour et al. 2025; Rajamo- han et al. 2026; Ghaffari et al. 2026); language foundation models use broader medical knowledge to propose additional diagnoses (Ben Shoham and Rappoport 2024; Ma et al. 2025; OpenAI 2025). These hypotheses may recover missed transitions but need not be grounded in the patient record. Under a fixed top-K budget, the central challenge is there- fore to determine which candidates to investigate, ground, and retain. This control problem motivates DeepResearch: agents maintain state, plan questions, invoke tools, and revise hy- potheses from evidence (Yao et al. 2023; Jin et al. 2025; Li et al. 2025; Wang et al. 2026). Here, foundation models gen- erate candidates, while medical search and ICD dictionaries provide transition evidence and semantic verification (Yuan et al. 2025). Forecasting differs from answer retrieval because no source contains the future code set. External evidence can support a transition or verify a code, but only the pre-target record can ground it in the patient; research also adds candi- dates that compete for the same K positions. DeepResearch must therefore choose what to investigate, keep patient, rela- tion, and code evidence distinct, and jointly select candidates under a fixed budget. ICD-Deepresearch is designed around these decisions (Figure 1). Candidate Generation calls SparseEHR to pro- duce an EHR Prior, while a parallel Direct Forecast calls GPT-5 for an independent code list (Ghaffari et al. 2026; OpenAI 2025). Only the EHR Prior initializes Research Ex- pansion, keeping the research agenda anchored to the longitu- dinal record while preserving language-model candidates as an independent path. Research Expansion then performs two bounded rounds of query planning, retrieval, reading, and arXiv:2608.17075v1 [cs.CL] 17 Aug 2026 Traditional EHR Models Encode records and learn temporal patterns High accuracy on known data, limited adaptability to new or rare cases. Direct LLM Forecasting Prompt the LLM with history; rely on internal knowledge Prompt · Flexible and general, but prone to omissions and unverifiable outputs. AB ... EHR trajectory 퐻 푖 Temporal pattern learning Model encoding Embeddings Timeline ... ... ... Risk / code logits Strength: Strong representation Captures long-range patterns in fixed history. Limitation: Fixed evidence at inference Cannot acquire new case-specific evidence. ... ? Limitation: No explicit retrieval Cannot access case-specific external evidence. Limitation: Weak provenance Predictions not tied to sources; hard to verify. Prompt-only reasoning Parametric knowledgeHistory-only prompt Provide 퐻 푖 to the LLM Broad world knowledge (incl. medical knowledge) embedded in parameters ............... LLM output · History-only forecast Foundation Model’s candidates from 퐻 푖 ... ... Patient-conditioned search 12 Candidate expansion 3 Source-aware validation 4 Link codes to supporting sources Check plausibility & relevance Retrieve additional candidate codes Generate queries from 퐻 푖 Why it helps √ Traceable provenance (query → source → code) √ √ √ Recover missed candidates Expanded, evidence-linked candidates ... C ICD-Deepresearch (ours) Retrieve, reason, and select with evidence Direct Forecast Research Expansion Evidence binding Final Selection jointly rank direct + researched candidates Top-K ICD forecast Post-selection rationale uses saved sources when available. Post-selection rationale Joint top-K selection Figure 1: Foundation models as forecasting tools. ICD-Deepresearch uses structured-EHR and language foundation models as complementary candidate generators, researches patient-anchored EHR candidates, and jointly selects all candidates under a fixed top-K budget. verification to connect candidates with directional clinical evidence and exact code semantics. Final Selection validates, deduplicates, and jointly ranks candidates from both paths. Supporting rationales are generated only after the predictions are fixed. We evaluate ICD-Deepresearch on MIMIC-I and MIMIC-IV (Johnson et al. 2016, 2023). It outperforms Can- didate Generation Only and standalone GPT-5 Web Search at both reported cutoffs, and joint selection outperforms the isolated candidate paths and standalone research systems, including Medical Deep Research (Clinical-Copilot 2026). Physician audits further show that Research Expansion re- trieves fewer documents while producing a higher proportion of useful evidence. Together, these results show that DeepRe- search benefits forecasting when it controls candidate expan- sion, evidence acquisition, and fixed-budget selection rather than treating search as a way to retrieve the future answer. 2 Related Work Longitudinal multi-label forecasting. Prior models gen- erate future visits and improve recurrence modeling, multi- modal robustness, code-aware ranking, or calibration (Yang et al. 2023; Kraljevic et al. 2024; Fallahpour et al. 2025; Theodorou et al. 2025; Shmatko et al. 2025; Rajamohan et al. 2026; Ben Shoham and Rappoport 2024; Koo 2025; Ma et al. 2025; Zhang et al. 2025). These methods forecast from the observed record, learned parameters, and static code re- sources. SparseEHR provides the structured-EHR backbone inside our Candidate Generation module (Ghaffari et al. 2026); ICD-Deepresearch augments the module’s initial can- didate state with direct generation, patient-conditioned evi- dence acquisition, and joint selection. Adaptive retrieval and latent-query search. Adaptive RAG systems learn when and how deeply to retrieve, while recent research agents interleave query decomposition, read- ing, memory, and decision updates (Asai et al. 2024; Jeong et al. 2024; Jin et al. 2025; Song et al. 2025; Tan et al. 2025; Li et al. 2025; Zheng et al. 2025; Shi et al. 2025). Clinical agents retrieve for a specified diagnosis or deci- sion (Shi et al. 2024; Rose et al. 2025; Li et al. 2026). Medical Deep Research provides an open-source multi-agent work- flow that decomposes medical questions and coordinates spe- cialized databases, web search, analysis, and report genera- tion (Clinical-Copilot 2026). We evaluate it as a standalone domain-specific research comparator. Next-encounter fore- casting begins from a trajectory without an explicit query; Research Expansion pairs a patient anchor with a candidate transition, retrieves evidence for that relation, maps it to an exact code, and updates the candidate ranking. Retrospective coding and prospective explanation. Ret- rospective automatic coding assigns ICD labels after the tar- get encounter has been documented; its evidence therefore comes from a completed note that already describes the rel- evant diagnoses (Mullenbach et al. 2018; Baksi et al. 2025; Motzfeldt et al. 2025; Yuan et al. 2025; Yin et al. 2026; Zheng et al. 2026). Next-encounter forecasting operates un- der a different information boundary: the target encounter, its documentation, and its ICD code set are all unavailable when the prediction is made. A prospective explanation must instead connect evidence in the pre-target record to a plau- sible directional clinical transition and the exact semantics of the predicted code, without treating a code definition as evidence that the event will occur. Our post-selection audit reflects this distinction by separately evaluating observed pa- tient facts, external clinical relations, ICD semantics, forecast uncertainty, and prediction-set coverage. 3 Method System Overview ICD-Deepresearch comprises three forecasting stages fol- lowed by a separate explanation stage (Figure 2). In the first stage, two candidate paths run in parallel. Candidate Gen- eration maps the structured longitudinal record to an EHR Prior, whereas Direct Forecast maps the complete pre-target record to an independent GPT-5 code list. Only the EHR Prior initializes Research Expansion, which performs exactly two · 67-year-old male admitted from home ● Chronic systolic heart failure ● Cardiac catheterization Progressive Dyspnea · Fatigue Bilateral lower-extremity edema coronary artery disease hypertension History Clinical Presentation Demographics illustrative de-identified case Discharge Note MIMIC Patient Case Diagnoses · Procedures Historical Context prior ICD prior ICD CPT 퐈 ퟏ 퐈 ퟐ 퐈 ퟑ 퐈 ퟒ Chronic Heart Failure: Symptoms ... Mayo Clinic,AHA-common symptoms shortness of breath, fatigue, edema... Heart Failure - Symptoms and Causes AAHF - diagnosis,exercise tolerance... Patient Education: Heart Failure MedlinePlus - dyspnea, fatigue, fluid retention... · chronic heart failure symptoms symptomsprocedurescandidate-code terms Cardiac Catheterization: Overview NLM - diagnostic cardiac catheterization evaluates coronary anatomy ... Cardiac Catheterization - StatPearls NCBI - Indications and technigue... Percutaneous Coronary Intervention AHA - PCI for coronary artery stenosis... · cardiac catheterization procedures ICD-10-CM: I50 Heart failure AHA Coding - 150 definitions... ICD-10-CM Official Guidelines Cdc.gov - code selection depends on type, acuity, underlying cause... ICD-10 Code Lookup: I50 ICD10Data com - I50.2, I50.3, I50.4, I50.9 ... · ICD-10 Heart failure codes Dyspnea, fatigue, edema are common symptoms. Heart Failure: Symptoms & Causes Mayo Clinic 푺 ퟏ 푺 ퟐ 푺 ퟑ 푺 ퟒ Evaluates coronary anatomy and pressure. Cardiac Catheterization: Overview NCBI I50.x codes distinguish heart-failure subtypes. ICD-10-CM Heart Failure Codes ICD10Data Diagnosis and treatment depend on clinical subtype. Heart Failure Clinical Guideline ACC/AHA Read & Extract Evidence Follow relevant sublinks depth ≤ 5 links ≤ 10 search missing ICD evidencerefine diagnosis termfollow citation Differential Diagnosis of Dyspnea Mayo Clinic ICD-10-CM Official Coding Guidelines CDC PCI Outcomes in Heart Failure Patients JACC Evidence gaps ●Missing support ●Unresolved ICD cues best available evidence low-confidence flag 퐈 ퟏ 퐈 ퟐ 퐈 ퟑ 퐈 ퟒ Final ICD Prediction 퐐 ퟏ 퐐 ퟐ 퐐 ퟑ Initial Sources 푺 풕 Live Evidence Bank 푬 풕 Chronic Heart Failure: Symptoms and Causes Common symptoms include shortness of breath, fatigue, and reduced ability to exercise [1]. 50 0 100 72% 푪 풕 <흉 푪 풕 ≥흉 budget remains · budget exhausted read・extract・merge query budget · duplicate/non-medical pages · novelty gain · timeout / fetch failure 푪 풕 ≥흉 푪 풕 <흉 · 퐈 ퟏ 퐈 ퟐ 퐈 ퟑ 푪 푻 1 2 3 ICD 1 ICD 2 ICD 3 Chronic systolic HF supported by symptoms and coding rules [1][2][3] consistent with procedural context and literature [2][3] possible but less supported by evidence or specificity [1] 푪 풕 흉 1 Input:Patient Context Causes of heart failure include CAD, hypertension, and valvular disease [2]. Shortness of breath can be due to lung disease, anemia, or deconditioning [3]. Treatment focuses on lifestyle changes, medications, and in some cases, procedures/device therapy. Shortness of breath, fatigue [1] Edema; reduced exercise tolerance [1] Causes; CAD, hypertension, valve dz [2] Diagnosis clues I50.22 Chronic systolic (congestive) heart failure [3] I50.1 Left ventricular failure [2] I50.9 Heart failure, unspecified [3] Code descriptions HF symptoms impact functional capacity [1] PCI used for coronary artery stenosis [2] Code selection depends on type and acuity [3] Supporting evidence 푺 ퟏ · Lung disease, anemia, renal failure, and deconditioning can cause dyspnea... Use I50.22 for chronic systolic heart failure when symptoms are present... PCI can improve symptoms and quality of life in selected patients... CodingClinic:Heart Failure AAPC Documentation must support chronicity and systolic dysfunction ... 푺 풏+ퟐ 푺 풏+ퟏ · 푬 풕+ퟏ =푬 풕 푼∆푬 풕 3 ퟏ ퟎ Research Expansion & Evidence Bank 2 EHR Prior-Guided Query Planning Parallel Source Retrieval Verification & Final Selection Candidate Verification & Follow-Up bounded follow-up update state verification step bounded follow-up accept candidate Candidate Support Score Verified? New-Candidate Acceptance research additions only Final Selection rank direct + researched candidates Post-selection rationale Iteration 2: Replan from Evidence Retrieve Additional Sources Figure 2: ICD-Deepresearch pipeline. The EHR Prior initializes two research rounds; Direct Forecast remains independent until Final Selection. The Evidence-Aware Reranker defines the full model, RRF is a same-pool selector control, and rationales are written only after predictions are fixed. Details appear in Supplement Sec. S2. bounded iterations of query planning, retrieval, reading, ver- ification, and state update. Final Selection then validates and jointly ranks the union of the researched and direct candidates under one top-K budget. After predictions are fixed, Post- Selection Explanation writes supporting rationales without changing the selected codes or their order. Task, Inputs, and Outputs For dataset d, let Ω d denote its valid diagnosis-code vocabu- lary. Patienti hasm i observed encounters before the held-out target encounter. The available pre-target record is H i = (d i ,E 1 i ,...,E m i i ,N i ),(1) where d i contains demographics, E j i is the set of diagnosis and procedure events recorded at encounter j, and N i is the possibly empty collection of notes available before the cutoff. Its structured portion is H str i = (d i ,E 1 i ,...,E m i i ). The tar- get Y i ⊆ Ω d is the deduplicated diagnosis-code set recorded at the held-out encounter. All inference-time generation, tool use, ranking, and explanation operate only on H i . A predictor returns a finite ordered list π i = (π i1 ,...) of unique, vocabulary-valid codes. All evaluated systems re- turn at least 20 such codes. For K ∈ 10, 20, the exact-K prediction set is b Y (K) i = π ij : 1≤ j ≤ K.(2) A single ranking therefore supports evaluation at both re- ported cutoffs. Two Candidate Paths Candidate Generation: the EHR Prior. Let G F denote the complete Candidate Generation mapping. It converts the structured record into a finite, target-blind seed ranking π F i and its unordered candidate set B i : π F i =G F (H str i ; Ω d ), B i = set(π F i )⊆ Ω d . (3) For ICD-9-CM and ICD-10-CM forecasting, SparseEHR provides the learned structured-EHR backbone (Ghaffari et al. 2026). The complete mapping also includes task- specific input construction, vocabulary interfacing, valida- tion, and the registered output ranking. The Candidate Gen- eration Only control evaluates this entire mapping, including the SparseEHR backbone. The identities and native ranks in π F i are fixed before Research Expansion begins. Direct Forecast: the independent path. Let G D denote the GPT-5 Direct Forecast mapping. It uses the complete pre-target record to return a finite ordered list D i : D i =G D (H i ; Ω d ).(4) Thus, π F i and D i are ordered lists, whereas B i is a set. Direct Forecast can use both structured events and pre-target notes, but its state remains outside the research loop until Final Selection. It can therefore contribute hypotheses absent from the EHR Prior without determining which candidates Research Expansion investigates. Research Expansion Research Expansion begins with the EHR Prior set B i . For each hypothesis, it keeps three information roles distinct: an observed patient clue, external evidence about a possible clinical transition, and the exact meaning of the proposed ICD code. One iteration applies Plan→ ToolAct→ ReadBind→ Verify→ UpdateRank. ToolAct invokes Google or the fixed PMC/arXiv corpora; the remaining operations construct and update the research state. Let Z (r) i denote the candidate hypotheses, candidate- bound evidence memory, support and verification fields, and unresolved directions after research iteration r. The initial state is Z (0) i = (B i ,∅), where ∅ denotes empty evidence, verification, and unresolved-direction fields. LetDR denote one fixed, registered Research Expansion state transition and letT d denote the available tool collection. The executor applies the transition exactly twice: Z (r) i =DR! H i ,B i ,Z (r−1) i ;T d , r ∈ 1, 2, (5) where T d contains the online Google channel, fixed PMC/arXiv corpora, and the ICD dictionary for dataset d. In each iteration, the planner forms patient-anchored candidate– query pairs; the tools retrieve medical sources and code defi- nitions; the reader binds passages to candidates; verification evaluates the patient anchor, proposed clinical relation, and exact-code mapping; and the rank update carries the resulting state forward. Acceptance checks apply only to newly pro- posed research additions. When budget remains, unresolved additions can trigger bounded follow-up, and the second iter- ation conditions on the complete state produced by the first. FinalizingZ (2) i yields a research candidate setC R i , an or- dered research list R i , and an accumulated candidate-bound ledger L (2) i . Here, L (2) i is the evidence-memory component of the final research state. It stores zero or more retrieval records for each researched candidate, including explicit no- result and unreadable states; retained passages remain linked to their queries and candidates. Supplement Secs. S2 and S5–S6 specify the executable calls, tool contracts, and fail- ure states. Joint Final Selection Final Selection combines the direct and research paths. It constructs the vocabulary-valid union candidate set C U i =V d ! C R i ∪ set(D i ) ,(6) whereV d deterministically canonicalizes code identities, re- moves codes outside Ω d , and merges duplicate identities. Superscripts R and U denote the research and union candi- date sets, respectively. Evidence-Aware Reranker. The full selector scores each candidate c ∈ C U i using the pre-target record, generator ranks, occurrence metadata, and candidate-bound evidence, and sorts the scores to obtain π full i . The RRF control below uses the same frozen candidate pool and differs only in the selection rule. RRF selector control. The selector control replaces only the Evidence-Aware Reranker with reciprocal rank fusion. Let P D i = D i and P R i = R i denote the direct and research rankings after stable vocabulary validation and deduplica- tion. For p∈ D,R, let r p i (c) be the one-based rank of canon- ical code c when c∈ P p i . For every c∈C U i , RRF assigns s RRF i (c) = X p∈D,R,c∈P p i 1 k 0 + r p i (c) (7) An empty sum is zero, so a path contributes nothing when it does not contain c. Sorting C U i by decreasing s RRF i (c), with canonical code identity as the deterministic tie-breaker, yields π RRF i . Thus, π full i and π RRF i are ordered lists over the same frozen candidate state and each can instantiate the generic ranking π i in Equation 2. Their comparison changes only the selection rule while keeping candidate availability fixed. Full pool construction and selector contracts appear in Supplement Sec. S2.4. Post-Selection Explanation The explanation writer runs after the selected top-K codes and their order have been fixed. For each code, it receives the pre-target record, canonical code information, and any saved candidate-bound evidence, and returns a rationale and an uncertainty statement. Each rationale distinguishes the observed patient clue, external clinical relation, exact ICD meaning, and forecast uncertainty. The reported explanation audit uses the registered RRF-selected ranking π RRF i ; Sup- plement Sec. S2.5 provides the complete writer contract. 4 Experimental Design Evaluation logic. We evaluate forecasting, component and selector controls, retrieval quality and efficiency, and post- selection explanations (RQ1–RQ4). MIMIC-I/IV use held- out final admissions with ICD-9-CM/ICD-10-CM targets (Johnson et al. 2016, 2023). Table 1 reports scale cohorts, whereas Table 2 uses separate subset diagnostic cohorts; comparisons remain within each table and dataset. Supple- ment Secs. S3.1–S3.2 provide the analysis registry, cohort sizes and splits, and outcome construction. Comparators and controls. The published block imports THCM-CAL Table 2 values (Zhang et al. 2025); original baseline sources and numerical provenance are listed in Sup- plement Sec. S3.3. Local experiments compare Candidate Generation Only and the full system with standalone GPT- 5 Web Search; component controls isolate the Direct and Research paths, and vary research context under a fixed candidate pool. Medical Deep Research (Clinical-Copilot 2026) is a second standalone comparator and receives nei- ther our EHR Prior, research ledger, nor selector. Supple- ment Secs. S3.3–S3.4 specify prompts, retrieval budgets, MIMIC-IIIMIMIC-IV MethodP@10R@10P@20R@20P@10R@10P@20R@20 Published reference results CAML20.6118.1514.9825.7420.6127.3814.0335.52 ZAGCNN17.5015.5112.6121.6321.1028.1314.3336.17 GatorTron20.5317.7215.0325.6622.8730.1915.4738.81 DistilBioBERT20.1817.8514.9825.6222.5929.8315.3338.50 Chet24.5218.8218.6127.7119.0626.6512.6234.11 DKEC20.6417.9214.5524.4720.0326.5013.6134.59 BioMedLM20.5617.8414.9025.3820.7227.6814.0935.32 THCM-CAL30.0224.0421.4733.1628.8337.0318.6646.04 Local registered scale-cohort results ICD-Deepresearch: Candidate Generation Only31.6822.5920.9229.8429.2120.7823.3533.22 GPT-5 + Web Search (Standalone)29.8621.2922.7732.4828.5320.2922.1831.56 ICD-Deepresearch35.3325.2024.6035.0933.4639.4125.1448.32 Table 1: Exact-K forecasting results. P@K/R@K are patient-averaged. Published THCM-CAL-protocol values are transcribed from its Table 2 (Zhang et al. 2025) and form a separate block. Boldface indicates the best result within each block. model snapshots, seeds, implementation details, and con- trolled states. Metrics and audits. Table 1 uses patient-averaged P@K/R@K; Table 2 uses pooled micro-P/R/F1 and patient- macro F1. Retrieval audits report source composition, meta- data support/forecast usefulness, and blinded physician usefulness; explanations use five reason dimensions and coverage-adjusted Reason5. Supplement Sec. S3.5 defines metrics and inference, while Secs. S3.6–S3.8 specify source sampling, efficiency accounting, and explanation judge con- tracts. 5 Results and Discussion RQ1: Complementary Candidate States Require Joint Selection On the registered scale cohorts, the full ICD- Deepresearch system reaches patient-averaged P@20/R@20 of 24.60/35.09% on MIMIC-I and 25.14/48.32% on MIMIC-IV. At K = 20, it exceeds GPT-5 + Web Search (Standalone) by +1.83/ + 2.61 precision/recall points on MIMIC-I and +2.96/+16.76 on MIMIC-IV; relative to the Candidate Generation Only control, the gains are +3.68/ + 5.25 and +1.79/ + 15.10 points. ICD-Deepresearch also leads both local comparators at K = 10 (Table 1). The functional audit uses separate registered diagnostic cohorts and pooled metrics; its absolute values are there- fore interpreted within Table 2, not against the scale-cohort values in Table 1. On MIMIC-I, the best isolated path reaches 25.56 micro-F1, compared with 26.73 for ICD- Deepresearch w/o Evidence-Aware Reranker and 29.25 for ICD-Deepresearch. On MIMIC-IV, the Research Path Only control reaches 32.90 and ICD-Deepresearch w/o Evidence- Aware Reranker reaches 34.85, while the full system reaches 35.44 (Table 2). The Evidence-Aware Reranker therefore adds 2.52 points over RRF on MIMIC-I and 0.59 on MIMIC-IV. Among standalone research systems, GPT-5 + Web Search reaches 26.84/33.37 micro-F1 and Medical Deep Research reaches 21.08/15.74 on MIMIC-I/MIMIC- IV. The joint system exceeds every isolated path and stan- dalone comparator in both diagnostic cohorts. The row-62 trace shows ICD-Deepresearch w/o Evidence- Aware Reranker preserving branch-exclusive hits and pro- moting a candidate supported at moderate ranks by both branches; it returns eight true positives, compared with five for GPT-5 (Direct Forecasting) and six for the Research Path Only control (Supplement Sec. S8). The MIMIC-I joint-pool oracle reaches 37.53 micro-F1, 8.28 points above ICD-Deepresearch, locating substantial remaining head- room in slot allocation over the observed pool (Supplement Sec. S4.1). RQ2: Search Depth Is a State-Dependent Allocation Problem The fixed-pool control measures context-assisted ranking af- ter candidate generation. With candidate identities, order, GPT-5 backend, and K = 20 fixed, the Research Expansion packet changes micro-F1 by +0.12 points on MIMIC-I (95% CI −1.12 to +1.33) and +1.90 on MIMIC-IV. The fixed-pool oracles remain 5.75 and 5.59 points higher. This contrast estimates the selector’s use of the delivered research packet conditional on an already research-expanded pool; the natural-cardinality analysis below separately character- izes candidate coverage and growth (Supplement Sec. S4.6). Natural-cardinality diagnostics show why coverage must be evaluated together with candidate growth. On EHRSHOT, two iterations recover 144 additional targets while increas- ing mean pool size from 19.8 to 51.0 and reducing micro-F1 from 25.82% to 16.34%. Initial expansion changes micro-F1 by +3.06 and +9.04 points on the MIMIC-I and MIMIC- IV diagnostics, whereas follow-up changes it by−0.98 and −0.004. The MIMIC-IV follow-up yield is 12.96%, nearly equal to its 13.01% break-even requirement (Figure 4; Sup- plement Sec. S4.6). The near-zero cohort mean hides concentrated benefit: 26 of 28 MIMIC-IV follow-up matches occur in 13 patients, while 52 patients worsen. Rows 52 and 59 obtain four of eight DatasetSystem variantMicro-P Micro-R Micro-F1 Macro-F1 Panel A: individual candidate paths and joint selection MIMIC-I ICD-Deepresearch: Candidate Generation Only21.5430.4525.2324.12 ICD-Deepresearch: Direct Forecast Only21.8030.9025.5624.80 ICD-Deepresearch: Research Path Only20.7129.2924.2723.53 ICD-Deepresearch w/o Evidence-Aware Reranker22.8132.2626.7325.88 ICD-Deepresearch24.9735.3029.2528.21 MIMIC-IV ICD-Deepresearch: Candidate Generation Only14.4020.6916.9816.88 ICD-Deepresearch: Direct Forecast Only26.6038.2031.3630.60 ICD-Deepresearch: Research Path Only27.9040.0932.9032.04 ICD-Deepresearch w/o Evidence-Aware Reranker29.5542.4634.8533.98 ICD-Deepresearch30.0543.1835.4434.54 Panel B: standalone research comparators MIMIC-I GPT-5 + Web Search (Standalone)22.9132.4026.8425.94 Medical Deep Research (Standalone)17.6026.2921.0820.53 MIMIC-IV GPT-5 + Web Search (Standalone)28.3040.6633.3732.63 Medical Deep Research (Standalone)13.4019.0615.7415.56 Panel C: fixed-pool research-context control MIMIC-I ICD-Deepresearch with Research Context (Fixed Pool)22.3035.1227.2826.39 ICD-Deepresearch without Research Context (Fixed Pool)22.2034.9627.1626.48 MIMIC-IV ICD-Deepresearch with Research Context (Fixed Pool)25.2036.9529.9629.50 ICD-Deepresearch without Research Context (Fixed Pool)23.6034.6028.0627.79 Table 2: Component analysis at K = 20. Panels compare isolated paths and joint selectors (A), standalone research comparators (B), and research context under a fixed candidate pool (C). Values are percentages. Retrieval volumeSource composition (%)Metadata proxy (%) Blinded audit (%) DatasetSystemUses Uniq. Peer Offic. Clin. Coding Repo. Forum Other Supp.Fcast.Phys. MIMIC-I GPT-5 + Web Search 13,394 6,363 7.3 19.0 1.1 30.7 6.6 16.2 19.1 30.06.022.0 Medical Deep Research37,724 26,268 44.2 12.7 2.8 25.7 0.5 0.0 14.1 58.034.032.0 Research Expansion 1,410 1,246 34.2 6.8 7.2 29.3 0.1 0.0 22.4 62.022.051.0 MIMIC-IV GPT-5 + Web Search 25,100 12,589 1.1 16.3 0.5 21.2 5.0 21.3 34.6 34.04.039.0 Medical Deep Research37,989 28,072 45.2 19.2 3.37.5 0.4 0.0 24.3 50.034.041.0 Research Expansion 11,124 9,178 50.9 4.5 4.6 17.7 0.1 0.0 22.1 64.036.068.0 Table 3: Retrieved-source composition and usefulness audits. Uses/Uniq. are counts after excluding deterministic dictionary citations; all other entries are percentages. Abbreviations and sampling are defined in Supplement Sec. S3.6. Bold identifies Research Expansion, not a columnwise maximum. and zero of nine follow-up matches, respectively. A post-hoc support-score filter retains 21 of the 28 matches, reduces mean pool size from 38.19 to 36.64, and raises micro-F1 from 26.02% to 26.54% (Supplement Secs. S4.1 and S8). These diagnostics motivate learning marginal expansion value from the current state and stopping when expected yield falls below the cardinality cost. RQ3: Focused Retrieval Improves Physician-Rated Usefulness Research Expansion retrieves substantially fewer source oc- currences than either standalone system: 1,410 on MIMIC-I and 11,124 on MIMIC-IV, compared with 13,394/25,100 for GPT-5 + Web Search and 37,724/37,989 for Medical Deep Research (Table 3). Despite this smaller retrieval set, it at- tains the highest physician-rated usefulness on both datasets: 51% versus 22% and 32% on MIMIC-I, and 68% versus 39% and 41% on MIMIC-IV. The automated proxies reveal a different ordering. Medi- cal Deep Research has the highest peer-reviewed share and forecast-usefulness rate on MIMIC-I (44.2% and 34%). Research Expansion has the highest peer-reviewed share on MIMIC-IV (50.9%), support rate on both datasets (62% and 64%), and forecast-usefulness rate on MIMIC-IV (36%). Source category and metadata relevance therefore do not sub- stitute for clinician judgment of case-specific usefulness; the patient-conditioned research state is most clearly associated with selective retrieval and higher physician-rated utility. On matched cohorts, Research Expansion uses 7.3×/3.4× fewer unique queries, 3.8×/4.5× fewer source accesses, and 6.1×/2.9× fewer visible tokens; recorded batched throughput is 16.8×/21.9× higher, with F1@20 changing from 26.4 to 30.2 and from 33.3 to 34.8 (Supplement Sec. S4.4). Paired traces show the associated query shift: Research Expansion searches patient-linked transitions such as glycemic control to ulcer healing, whereas the paired standalone-search traces emphasize code lists and return forum pages (Supplement Sec. S8). The paired traces illustrate how the candidate– 2344.54.85 Absolute Reason5 (upper-tail log scale) Clinical validity Patient grounding Next-visit relevance ICD alignment Evidential calibration a MIMIC-I Reason5 4.86 4.61 3.34 4.95 4.47 0.00.10.2 Reason5 +0.04 +0.11 +0.05 +0.08 +0.21 Gain over GPT-5 2344.54.85 Absolute Reason5 (upper-tail log scale) b MIMIC-IV Reason5 4.97 4.87 3.53 4.99 4.69 0.00.10.2 Reason5 +0.11 +0.12 +0.01 +0.07 +0.22 Gain over GPT-5 0.7511.21.351.51.58 Absolute CA-RQ5 (upper-tail log scale) 1.33 1.29 (+0.04) 0.97 0.77 MIMIC-I 1.57 1.36 (+0.21) 1.20 0.75 MIMIC-IV c Coverage-adjusted Reason5 ICD-DeepresearchDirect GPT-5Direct GPT-4oDirect GPT-4o-mini Figure 3: Post-selection explanation quality. Panels (a–b) show Reason5 on each system’s true-positive predictions; panel (c) combines reason quality with coverage at K = 20. The ICD-Deepresearch arm is RRF-selected. Exact values and the judge contract appear in Supplement Secs. S6.1 and S3.8. UpIter. 1Iter. 2 0 10 20 30 40 50 60 Recall (%) 49.2 56.2 57.6 42.4 52.2 56.2 (a) EHRSHOT recall ExampleMicro UpIter. 1Iter. 2 0 10 20 30 40 50 60 Mean pool size 19.8 44.2 51.0 +102 hits +42 hits (b) Pool growth M3-IM3-FM4-IM4-FE-IE-F 0 5 10 15 20 25 30 35 Matched additions (%) 30.6% 38/124 8.0% 7/87 22.6% 362/1603 13.0% 28/216 3.5% 102/2926 5.1% 42/818 M3/M4 = MIMIC-I/IV; E = EHRSHOT (c) Yield vs. F1/2 boundary ΔF1 > 0 ΔF1 ≤ 0 required F1/2 −10−50510 Δ micro-F1 (p) M3-I M3-F M4-I M4-F E-I E-F +3.06 -0.98 +9.04 -0.004 -8.70 -0.78 (d) F1 change Figure 4: Candidate expansion before Final Selection. Panels show target recall, pool growth, match yield against the exact micro-F1/2 break-even threshold, and the resulting ∆micro-F1. anchor–relation state can direct queries toward patient-linked transitions rather than generic code lists. RQ4: Explanation State Improves Semantics More Than Temporal Grounding Shared-hit comparisons evaluate identical patient–code predictions. Across 441 MIMIC-I shared hits, ICD- Deepresearch (RRF-selected) improves exact ICD alignment by 0.07 points (95% CI +0.02 to +0.12) and evidential cal- ibration by 0.22 (+0.15 to +0.29). Across 479 MIMIC-IV shared hits, clinical validity, patient grounding, ICD align- ment, and calibration improve, while next-encounter rele- vance changes by only +0.03 (−0.04 to +0.08). Coverage- adjusted quality rises from 1.36 to 1.57 on MIMIC-IV (95% CI +0.15 to +0.27), while MIMIC-I changes from 1.29 to 1.33 (−0.02 to +0.09). The clearest gains are in code semantics and calibration; the temporal bridge to the next encounter remains weak (Figure 3; Supplement Secs. S4.5 and S6.1). The row-45 paired case isolates this distinction. GPT-5 (Direct Forecasting) and ICD-Deepresearch (RRF-selected) recover the same three codes at K = 20, but their shared-hit Reason5 means are 3.47 and 4.80. GPT-5 describes O34.13 only as a uterine-scar code, whereas ICD-Deepresearch uses its canonical title to align it with the observed leiomyoma trajectory. All 20 citations are ICD definitions, making code identity inspectable while leaving the immediate-horizon re- lation grounded in the patient record (Supplement Sec. S8). This separation also clarifies the remaining failures. Next- encounter relevance is the lowest Reason5 dimension, while independent relation sources cover only 11.62patient an- chors, query–candidate drift, definition–forecast conflation, semantic mismatches, horizon-polarity errors, and uncon- trolled cardinality. They motivate a three-link verification tar- get: an immutable pre-target patient span, a source-entailed directional relation, and an exact code expressing the same entity at the immediate forecasting horizon (Supplement Secs. S8–S9). 6 Conclusion Across the four RQs, next-encounter ICD forecasting emerges as budgeted hypothesis search: candidate expansion broadens coverage but also enlarges the pool that Final Selec- tion must resolve. The MIMIC-I target-conditioned oracle leaves 8.28 micro-F1 points of joint-pool selection head- room; attaching research context changes micro-F1 by +0.12 and +1.90 on MIMIC-I and MIMIC-IV, respectively; and independent relation-source coverage is only 11.62% and 1.39%. Candidate-conditioned retrieval yields denser physician-rated evidence, while the richer post-selection state is associated more strongly with exact-code alignment and calibration than with immediate-horizon relevance. These results motivate a state-aware controller that expands only when the expected marginal value justifies a candidate with a patient anchor, directional clinical relation, and verified code semantics; otherwise, it retains the current pool or stops. References Asai, A.; Wu, Z.; Wang, Y.; Sil, A.; and Hajishirzi, H. 2024. Self-RAG: Learning to Retrieve, Generate, and Cri- tique through Self-Reflection. In International Conference on Learning Representations. Baksi, K. D.; Soba, E.; Higgins, J. J.; Saini, R.; Wood, J.; Cook, J.; Scott, J. I.; Pudota, N.; Weninger, T.; Bowen, E.; and Bhattacharya, S. 2025. MedCodER: A Generative AI Assistant for Medical Coding. In Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the As- sociation for Computational Linguistics: Human Language Technologies (Volume 3: Industry Track), 449–459. Associ- ation for Computational Linguistics. Ben Shoham, O.; and Rappoport, N. 2024. CPLLM: Clini- cal Prediction with Large Language Models. PLOS Digital Health, 3(12): e0000680. Bolton, E.; Venigalla, A.; Yasunaga, M.; Hall, D.; Xiong, B.; Lee, T.; Daneshjou, R.; Frankle, J.; Liang, P.; Carbin, M.; and Manning, C. D. 2024. BioMedLM: A 2.7B Parameter Language Model Trained on Biomedical Text. arXiv preprint arXiv:2403.18421. Centers for Medicare & Medicaid Services (U.S.); National Center for Health Statistics (U.S.); American Hospital Asso- ciation; and American Health Information Management As- sociation. 2025. ICD-10-CM Official Guidelines for Coding and Reporting: FY 2026 – Updated October 1, 2025 (Oc- tober 1, 2025–September 30, 2026). Technical report, U.S. Department of Health and Human Services, Hyattsville, MD. Clinical-Copilot. 2026. Medical Deep Research: An Open- Source Agentic System for Comprehensive Medical and Clinical Investigations. https://github.com/Clinical-Copilot/ Medical_Deep_Research. Software repository, accessed July 29, 2026. Fallahpour, A.; Alinoori, M.; Ye, W.; Cao, X.; Afkanpour, A.; and Krishnan, A. 2025. EHRMamba: Towards Generaliz- able and Scalable Foundation Models for Electronic Health Records. In Proceedings of the 4th Machine Learning for Health Symposium, volume 259 of Proceedings of Machine Learning Research, 291–307. PMLR. Ge, X.; Satpathy, A.; Williams, R. D.; Stankovic, J.; and Alemzadeh, H. 2024. DKEC: Domain Knowledge En- hanced Multi-Label Classification for Diagnosis Prediction. In Proceedings of the 2024 Conference on Empirical Meth- ods in Natural Language Processing, 12798–12813. Miami, Florida, USA: Association for Computational Linguistics. Ghaffari, M.; Agarwal, A.; Fatehi, N.; Leong, L.; Linden, T.; Hassanzadeh, R.; and Morato, C. 2026. SparseEHR: Scalable Foundation Modeling for Structured EHR via Conditional Computation. In ICML 2026 Workshop on Structured Data for Health. Jeong, S.; Baek, J.; Cho, S.; Hwang, S. J.; and Park, J. C. 2024. Adaptive-RAG: Learning to Adapt Retrieval- Augmented Large Language Models through Question Com- plexity. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Lin- guistics: Human Language Technologies. Jin, B.; Zeng, H.; Yue, Z.; Wang, D.; Zamani, H.; and Han, J. 2025. Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning. arXiv preprint arXiv:2503.09516. Johnson, A. E. W.; Bulgarelli, L.; Shen, L.; Gayles, A.; Sham- mout, A.; Horng, S.; Pollard, T. J.; Hao, S.; Moody, B.; Gow, B.; et al. 2023. MIMIC-IV, a Freely Accessible Electronic Health Record Dataset. Scientific Data, 10: 1. Johnson, A. E. W.; Pollard, T. J.; Shen, L.; Li-Wei, H. L.; Feng, M.; Ghassemi, M.; Moody, B.; Szolovits, P.; Celi, L. A.; and Mark, R. G. 2016. MIMIC-I, a Freely Accessible Critical Care Database. Scientific Data, 3: 160035. Koo, H. 2025. Overcoming Uncertain Incompleteness for Robust Multimodal Sequential Diagnosis Prediction via Curriculum Data Erasing Guided Knowledge Distillation. In ICASSP 2025–2025 IEEE International Conference on Acoustics, Speech and Signal Processing, 1–5. Kraljevic, Z.; Bean, D.; Shek, A.; Bendayan, R.; Hemingway, H.; Au Yeung, J.; Deng, A.; Baston, A.; Ross, J.; Idowu, E.; Teo, J. T.; and Dobson, R. J. B. 2024. Foresight—A Generative Pretrained Transformer for Modelling of Patient Timelines Using Electronic Health Records: A Retrospective Modelling Study. The Lancet Digital Health, 6(4): e281– e290. Li, D.; Liang, J.; Li, W.; Wang, X.; Cao, L.; and Yu, K. 2026. CliCARE: Grounding Large Language Models in Clinical Guidelines for Decision Support over Longitudinal Cancer Electronic Health Records. In Proceedings of the AAAI Con- ference on Artificial Intelligence, 31554–31562. Li, X.; Jin, J.; Dong, G.; Qian, H.; Wu, Y.; Wen, J.-R.; Zhu, Y.; and Dou, Z. 2025. WebThinker: Empowering Large Rea- soning Models with Deep Research Capability. In Advances in Neural Information Processing Systems, volume 38. Lu, C.; Han, T.; and Ning, Y. 2022. Context-Aware Health Event Prediction via Transition Functions on Dynamic Dis- ease Graphs. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, 4567–4574. Ma, M. D.; Wang, X.; Xiao, Y.; Cuturrufo, A.; Nori, V. S.; Halperin, E.; and Wang, W. 2025. Memorize and Rank: Elevating Large Language Models for Clinical Diagnosis Prediction. Proceedings of the AAAI Conference on Artificial Intelligence, 39(23): 24786–24794. Moor, M.; Banerjee, O.; Shakeri Hossein Abad, Z.; Krumholz, H. M.; Leskovec, J.; Topol, E. J.; and Rajpurkar, P. 2023. Foundation Models for Generalist Medical Artificial Intelligence. Nature, 616: 259–265. Motzfeldt, A. G.; Edin, J.; Christensen, C. L.; Hardmeier, C.; Maaløe, L.; and Rogers, A. 2025. Code Like Humans: A Multi-Agent Solution for Medical Coding. In Findings of the Association for Computational Linguistics: EMNLP 2025, 22612–22627. Suzhou, China: Association for Com- putational Linguistics. Mullenbach, J.; Wiegreffe, S.; Duke, J.; Sun, J.; and Eisen- stein, J. 2018. Explainable Prediction of Medical Codes from Clinical Text. In Proceedings of the 2018 Confer- ence of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 1101–1111. OpenAI. 2024a. GPT-4o mini: Advancing Cost-Efficient Intelligence. Released July 18, 2024. OpenAI. 2024b. GPT-4o System Card. Technical report, OpenAI. OpenAI. 2025. GPT-5 System Card. Technical report, Ope- nAI. Rajamohan, H. R.; Gao, X.; Zhu, W.; Huang, S.-L.; Chen, L.; Schulman, G.; Jin, H.; Li, S.; Wang, Y.; Yang, H.; Cho, K.; Deniz, C. M.; and Razavian, N. 2026. Scaling Recurrence- Aware Foundation Models for Clinical Records via Next- Visit Prediction. arXiv preprint arXiv:2603.24562. Rios, A.; and Kavuluru, R. 2018. Few-Shot and Zero-Shot Multi-Label Learning for Structured Label Spaces. In Pro- ceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, 3132–3142. Brussels, Bel- gium: Association for Computational Linguistics. Rohanian, O.; Nouriborji, M.; Kouchaki, S.; and Clifton, D. A. 2023. On the Effectiveness of Compact Biomedical Transformers. Bioinformatics, 39(3): btad103. Rose, D. P.; Hung, C.-C.; Lepri, M.; Alqassem, I.; Gash- teovski, K.; and Lawrence, C. 2025. MEDDxAgent: A Uni- fied Modular Agent Framework for Explainable Automatic Differential Diagnosis. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics, 13803–13826. Association for Computational Linguistics. Shi, W.; Xu, R.; Zhuang, Y.; Yu, Y.; Zhang, J.; Wu, H.; Zhu, Y.; Ho, J. C.; Yang, C.; and Wang, M. D. 2024. EHRAgent: Code Empowers Large Language Models for Few-Shot Com- plex Tabular Reasoning on Electronic Health Records. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, 22315–22339. Association for Computational Linguistics. Shi, Z.; Chen, Y.; Li, H.; Wei, W.; Ni, S.; Lyu, Y.; Fan, R.-Z.; Jin, B.; et al. 2025. Deep Research: A Systematic Survey. arXiv preprint arXiv:2512.02038. Shmatko, A.; Jung, A. W.; Gaurav, K.; Brunak, S.; Mortensen, L. H.; Birney, E.; Fitzgerald, T.; and Gerstung, M. 2025. Learning the Natural History of Human Disease with Generative Transformers. Nature, 647: 248–256. Song, H.; Jiang, J.; Min, Y.; Chen, J.; Chen, Z.; Zhao, W. X.; Fang, L.; and Wen, J.-R. 2025. R1-Searcher: Incentivizing the Search Capability in LLMs via Reinforcement Learning. arXiv preprint arXiv:2503.05592. Tan, Z.; Huang, J.; Wu, Q.; Zhang, H.; Zhuang, C.; and Gu, J. 2025. RAG-R1: Incentivize the Search and Reasoning Ca- pabilities of LLMs through Multi-Query Parallelism. arXiv preprint arXiv:2507.02962. Theodorou, B.; Xiao, C.; Glass, L.; and Sun, J. 2025. Me- diSim: Multi-Granular Simulation for Enriching Longitudi- nal, Multi-Modal Electronic Health Records. Patterns, 6(6): 101261. Wang, Z.; Wang, H.; Feng, S.; Yang, X.; Wang, D.; Zhang, Y.; Lin, J.; Ji, X.; and Yang, H. 2026. DeepMed: Building a Medical DeepResearch Agent via Multi-hop Med-Search Data and Turn-Controlled Agentic Training & Inference. In Findings of the Association for Computational Linguistics: ACL 2026, 18160–18178. Association for Computational Linguistics. Yang, X.; Chen, A.; PourNejatian, N.; Shin, H. C.; Smith, K. E.; Parisien, C.; Compas, C.; Martin, C.; Costa, A. B.; Flores, M. G.; et al. 2022. A Large Language Model for Electronic Health Records. npj Digital Medicine, 5: 194. Yang, Z.; Mitra, A.; Liu, W.; Berlowitz, D.; and Yu, H. 2023. TransformEHR: Transformer-Based Encoder–Decoder Gen- erative Model to Enhance Prediction of Disease Outcomes Using Electronic Health Records. Nature Communications, 14: 7857. Yao, S.; Zhao, J.; Yu, D.; Du, N.; Shafran, I.; Narasimhan, K.; and Cao, Y. 2023. ReAct: Synergizing Reasoning and Acting in Language Models. In International Conference on Learning Representations. Yin, Z.; Cao, Y.; Wang, T.; Chen, J.; and Ma, F. 2026. ICDA- GENT: Empowering Agentic Large Language Models for Explainable Medical Coding. In Proceedings of the 64th Annual Meeting of the Association for Computational Lin- guistics, 14131–14149. Yuan, M.; Shing, H.-C.; Strong, M.; and Shivade, C. 2025. Toward Reliable Clinical Coding with Language Models: Verification and Lightweight Adaptation. In Proceedings of the 2025 Conference on Empirical Methods in Natural Lan- guage Processing: Industry Track, 173–184. Suzhou, China: Association for Computational Linguistics. Zhang, X.; Wei, Q.; Zhu, Y.; Wu, F.; and Ananiadou, S. 2025. THCM-CAL: Temporal-Hierarchical Causal Mod- elling with Conformal Calibration for Clinical Risk Predic- tion. In Findings of the Association for Computational Lin- guistics: EMNLP 2025, 916–928. Zheng, J.; Nassar, I.; Vu, T.; Zhong, X.; Lin, Y.; Liu, T.; Duong, L.; and Li, Y. 2026. MedDCR: Learning to De- sign Agentic Workflows for Medical Coding. In Findings of the Association for Computational Linguistics: ACL 2026, 12878–12893. Zheng, Y.; Fu, D.; Hu, X.; Cai, X.; Ye, L.; Lu, P.; and Liu, P. 2025. DeepResearcher: Scaling Deep Research via Reinforcement Learning in Real-World Environments. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, 414–431. Association for Computational Linguistics. S1 Guide to the Supplementary Materials The main paper is the authoritative source for the reader-facing method definition, component names, information boundary, evaluation contracts, and reported claims. This supplement follows those definitions and provides implementation detail, diagnostics, prompt contracts, case traces, and artifact provenance. Throughout, ICD-Deepresearch without a qualifier denotes the full system with the Evidence-Aware Reranker. ICD-Deepresearch w/o Evidence-Aware Reranker denotes the controlled RRF selector replacement over the same available candidate state. The suffix Only denotes an isolated candidate path, whereas Standalone denotes an external system that does not share the ICD-Deepresearch pipeline. The post-selection explanation audit is explicitly labeled ICD-Deepresearch (RRF-selected) and is not an audit of explanations from the full Evidence-Aware output. Section S2 specifies the EHR Prior, Direct Forecast, Research Expansion, Final Selection, and the explanation writer. Section S3 describes cohorts, comparisons, metrics, source and efficiency accounting, uncertainty, and audit contracts. Section S4 reports method-aligned functional results, retrieval efficiency, and mechanism diagnostics. Section S5 gives the extended interpretation, limitations, and ethics details. Section S6 provides exact figure values and executable-call provenance, and Section S7 records the prompt contracts. Sections S8–S9 contain case traces and the cross-case error taxonomy. Quoted system messages and natural-language instructions are transcribed from the executable sources identified in Table S6. Long JSON contracts are shown verbatim or as complete required-field lists; dynamic fields use angle-bracket tokens, and runtime truncation or retry suffixes are recorded where relevant. Supplementary Map Method and protocol (S2–S3) Candidate Generation (SparseEHR backbone), Direct Forecast, Research Expansion, the Evidence-Aware final selector and its RRF replacement, prediction-locked explanation writing, cohorts, metrics, source accounting, and uncertainty. Functional results (S4) Component and selector controls; GPT-5 + Web Search (Standalone) and Medical Deep Research (Standalone), fixed-pool research-context input, iteration, transfer, source, efficiency, explanation, and safety analyses. Interpretation and records (S5–S7) Extended interpretation and limitations, exact figure values, executable-call provenance, runtime boundaries, and prompt contracts. Cases and error analysis (S8–S9) Success and failure traces, paired explanations, retrieval records, and cross-case mapping, entailment, horizon, and patient-anchor errors. S2 Full Method Specification Task and Information Boundary For dataset d, let Ω d denote its valid diagnosis-code vocabulary. Patient i has m i observed encounters before the held-out target encounter. Inference stops immediately before that encounter, and the available pre-target record is H i = (d i ,E 1 i ,...,E m i i ,N i ),(8) where d i contains demographics, E j i contains diagnosis and procedure events recorded at observed encounter j, and N i is the possibly empty collection of notes available before the cutoff. Any discharge note in N i belongs to an observed encounter, never to the held-out target encounter. The structured portion of the record is H str i = (d i ,E 1 i ,...,E m i i ). The target Y i ⊆ Ω d is the deduplicated diagnosis-code set recorded at the held-out encounter. All inference-time generation, retrieval, reading, ranking, and explanation use only H i and resources fixed independently of the evaluation targets. No target code, target-encounter note, or statistic computed from another evaluation patient is available to any forecasting component. The target Y i is accessed only after predictions are fixed, for metric computation and by the explicitly gold-aware explanation-evaluation judge. Search phrases remove patient identifiers present in the de-identified input. The executable calls use registered deterministic serializations of H i . For call a, let ν a (H i ) denote the fields and character- limited view specified in Section S7. Each ν a is a function only of the same pre-target record and therefore does not enlarge the information boundary. To avoid clutter, the component equations below write H i when the call-specific view is clear from context. Candidate Generation maps H str i to the registered, target-blind 20-code EHR Prior π F i =G F (H str i ; Ω d ), B i = set(π F i )⊆ Ω d .(9) Here, Candidate Generation is the complete module and π F i is its ordered EHR Prior output; B i is the corresponding unordered seed set. Only B i initializes Research Expansion. A predictor returns a finite ordered list π i = (π i1 ,...) of unique, vocabulary-valid codes. Every evaluated system returns at least 20 codes. For K ∈10, 20, its exact-K prediction set is b Y (K) i =π ij : 1≤ j ≤ K.(10) Thus, the same complete ranking supports both reported cutoffs, and no variable-length denominator is used in the primary exact- K evaluation. Throughout, π F i , D i , ̄ R i , R i , and π i are ordered lists; B i , Y i , and calligraphicC symbols are sets. Superscripts (1) and (2) identify the two bounded Research Expansion iterations, and superscripts RRF and full identify the two Final Selection protocols. ICD-Deepresearch comprises three forecasting stages followed by a separate explanation stage. In the first stage, Candidate Generation produces the EHR Prior (π F i ,B i ), while Direct Forecast independently produces D i from the complete pre-target record. Direct Forecast remains outside the research loop. In the second stage, Research Expansion is initialized only by B i . In the third stage, Final Selection validates and jointly ranks the union of researched and direct candidates. Post-Selection Explanation runs only after the selected codes and their order are fixed. Archived artifacts use FCG, DCG, DR-CG, and JCS for Candidate Generation, Direct Forecast, Research Expansion, and Final Selection, respectively. One Research Expansion iteration is the composite operation Plan→ ToolAct→ ReadBind→ Verify→ UpdateRank,(11) where ToolAct invokes Google or the fixed PMC/arXiv corpora and the updated state feeds the next Plan. LetZ (r) i denote the candidate hypotheses, candidate-bound evidence memory, support and verification fields, and unresolved directions after iteration r. The initial state isZ (0) i = (B i ,∅), where ∅ denotes empty evidence, verification, and unresolved-direction fields. Let DR denote the fixed registered state transition and T d the available tool collection. The executor applies the transition exactly twice: Z (r) i =DR H i ,B i ,Z (r−1) i ;T d , r ∈1, 2,(12) where T d contains the online Google channel, fixed PMC/arXiv corpora, and the dataset-specific ICD dictionary. The two applications share the same state-transition contract but invoke the round-specific planner, mapper, judge, and gate described below. The second iteration conditions on the candidate state, ledger, verification outcomes, and unresolved directions produced by the first. Historical artifacts use Stage 1 and Stage 2 for these two iterations. Finalizing Z (2) i returns the validated research pool C R i , its complete ordering ̄ R i , the thresholded research branch list R i , the accumulated ledger L (2) i , and proposal metadata M i . Final Selection then combines that target-blind research state with Direct Forecast. We register two selectors over the same artifact schema. ICD-Deepresearch w/o Evidence-Aware Reranker uses deterministic Union+RRF and yields π RRF i . The Evidence-Aware Reranker used by the full ICD-Deepresearch system yields π full i . Their comparison changes the selection rule while fixing candidate availability. Saved artifacts use AF/Union+RRF and FR for these selectors, respectively; these are provenance labels rather than model display names. The downstream explanation audit uses finalized RRF-selected outputs. EHR Prior and Direct Forecast Candidate Generation and its EHR Prior (internal label FCG; π F i ,B i ). For MIMIC-I and MIMIC-IV, SparseEHR supplies the learned structured-EHR backbone of Candidate Generation (Ghaffari et al. 2026). The complete module receives H str i , applies the task-specific target-vocabulary interface and validation, and exports the ordered 20-code EHR Prior π F i and seed set B i . Native ranks and code identities are fixed before research begins. For another structured code type, the conditional generator decodes directly into the native target vocabulary rather than applying an ICD-specific output head. The Candidate Generation Only control evaluates this complete mapping, including the SparseEHR backbone. Direct Forecast (internal label DCG; D i ). Direct Forecast maps H i to a bounded ordered list D i in the target vocabulary. Its prompt covers persistent disease, recurrence, durable status, treatment consequences, and plausible complications through one candidate ranking task. It receives no EHR Prior, research candidate, retrieved source, or output from another system. Direct Forecast can run concurrently with the first research-planning call, but its output is first exposed to the other path at Final Selection. Supplementary Table S2 evaluates the same function independently as Direct Forecast Only. Research Expansion (internal label DR-CG) The following paragraphs unroll the two registered applications of Equation 12. For each hypothesis, the state keeps the observed patient clue, evidence for a possible clinical transition, and the exact ICD definition distinct whenever those fields are available. Candidate formulation. The Iteration 1 planner receives (H i ,B i ) and proposes a bounded set G (1) i of structured candidate records x = (c,z,a,ℓ,o,u,q),(13) where c is the proposed code, z its clinical term, a a concrete clue in H i , ℓ a temporal class, o an ongoing-evidence flag, u a short falsifiable transition hypothesis, and q a search phrase. The allowed temporal classes are persistent status, chronic active disease, recurrent condition, planned follow-up, treatment consequence, and acute or laboratory speculation. The archived prompt enum acute_or_lab and the legacy selector value acute_speculation are normalized to this final class; they do not denote separate states. Define the code projection κ(x) = c and, for a set of proposal records, κ(G) =κ(x) : x∈ G. Proposal metadata are retained in M i and remain keyed to the canonical code after validation. This projection avoids identifying structured proposal records with code sets. History grounding and vocabulary validation. LetV d (·) denote deterministic validation into Ω d followed by deduplication. It normalizes punctuation and case, resolves each code against the dataset-specific ICD dictionary, removes duplicate or excluded codes, and replaces a model term with the canonical title. Let H ICD i ⊆ Ω d denote valid exact diagnosis codes in the pre-target history. After initialization from B i , the Iteration 1 candidate-formulation step converts each eligible member of H ICD i i into a history-grounded proposal record and appends those records before the candidate limit is applied. Thus, e C (1) i =V d κ(G (1) i )∪ (H ICD i \ B i ) .(14) All such codes are proposals rather than a second seed set and must pass the same acceptance stage described below before entering the finalized research pool. The archived Iteration 1 contract uses 8–18-term validation queries; Iteration 2 discovery and validation use 4–9-term relation queries. Both remove identifiers, dates, coding instructions, benchmark language, and concatenated multi-condition intents. Evidence acquisition and code-bound memory. The query scheduler converts each validated hypothesis into a paired search job using q from Equation 13. Each job remains bound to its patient, code, temporal class, and proposal record. Repeated retrieval within one patient can reuse a previously completed job only when the normalized code, temporal class, and query match; no query or retrieved observation is selected from another evaluation patient. The patient-local contract above is the authoritative method definition. Legacy artifacts that selected a shared query across evaluation patients do not satisfy this contract and are not interchangeable with release outputs; such artifacts require regeneration with cross-patient selection disabled. Tool boundary. The planner, memory, verifier, mapper, and support-score ranker determine the state transition in Equation 12; Google and PMC/arXiv return observations for queries selected by that transition. Online channel. The online worker submits q to the Google engine through the SearchCans search-engine-results-page (SERP) endpoint. The SERP response supplies a ranked title, URL, and search snippet for each result. The snippet supports discovery; the ledger stores a result only after the URL reader obtains usable body text. The reader opens the highest-ranked eligible URLs, rejects blocked, non-medical, duplicate, or nearly empty pages, and extracts a query-focused passage from each readable page. As registered in main-paper Figure 2, source-conditioned follow-up has maximum depth 5 and considers at most 10 eligible sublinks from a visited page. A support cue can stop additional reads within an already scheduled job before either limit is reached. Google requests are serialized and rate-limited, whereas independent URL reads run concurrently. Offline channel. The offline worker runs the same q against fixed local snapshots of PubMed Central and arXiv. PMC documents are represented by full JATS/XML and keyed by PMCID; arXiv documents retain their arXiv identifier, bibliographic metadata, and parsed article text. Retrieval matches the query against stored titles, abstracts, and article text and returns focused passages directly from the local corpus, so this channel makes no live Web request during inference. A Google result that resolves to a PMCID or arXiv identifier is canonicalized to the same document; the offline full text is used for passage extraction and the Google hit is retained as discovery provenance. Cross-channel merge and evidence ledger. The two engines run independently in each iteration. Hits are deduplicated first by PMCID, arXiv identifier, or DOI and then by normalized URL and title. For hypothesis x, the readers append records e = (c,u,a,ℓ,q,g,σ,ξ,b)(15) to the evidence ledger, where g ∈ Google, PMC, arXiv identifies the retrieval engine, σ contains the stable document identifier, title, and URL, ξ is the retained excerpt, and b is an automatic support cue based on entity and temporal-endpoint overlap. Let L (r) i denote the complete ledger accumulated through iteration r. A candidate can have zero, one, or multiple retrieval records; explicit no-result, unreadable-result, and readable-without-support states are also retained. Candidate, patient anchor, hypothesis, query, engine, source, excerpt, corpus or retrieval timestamp, iteration, and provenance remain separate fields. A readable code definition and an independent clinical transition source therefore remain distinguishable. Iteration 1 acceptance. After first-iteration reading, a separate judge receives H i , B i , each dictionary-valid proposal, and its candidate-bound evidence. It judges three roles independently: patient anchoring inH i , passage support for the proposed clinical bridge, and exact-code consistency across the anchor and bridge. Deterministic post-processing retains only accepted verdicts with resolvable evidence identifiers. The resulting additions are C (1) i ⊆ e C (1) i . Thus, e C (1) i contains dictionary-valid proposals, including history-grounded proposals, whereas C (1) i contains only additions that survive the registered gate. Acceptance checks do not re-gate the original EHR Prior codes in B i . Bounded source-conditioned follow-up. The second iteration separates discovery from exact-code validation. A query planner receives H i , B i , accepted and rejected Iteration 1 hypotheses, and prior source summaries, and emits a bounded set Q (2) i of 4–9-term relation queries; rejected Iteration 1 candidates are force-carried outside this call as unresolved directions, not as accepted codes. The paired Google and offline workers execute Q (2) i under the same depth-5 and 10-sublink reader limits and retain readable discovery passages. An exact-code mapper then receives H i , the current accepted code set, Q (2) i , and this discovery evidence and proposes a dictionary-valid set e C (2) i of new exact-code hypotheses, excluding codes already present in B i ∪ C (1) i . Each mapped proposal carries a patient anchor, temporal class, transition hypothesis, and fresh candidate-specific vali- dation queries. Those queries run through the same dual search, reading, deduplication, and ledger-writing path. A three- part Iteration 2 judge evaluates patient anchor, literature bridge, and exact mapping separately and returns gate confidence γ (2) i (c) ∈ [0, 1]. For records returned by the default or evidence-repair contract in Table S12, deterministic post-processing retains only accept=true records for which all three checks pass, γ (2) i (c)≥ 0.68, support is not historical- or risk-only, and cited evidence identifiers resolve to the candidate or its discovery query. Missing verdicts receive dataset-specific completion calls, and an evidence-repair call can rejudge the same fixed proposal using the prior decision and newly matched evidence; none of these calls creates a new candidate. The archived MIMIC-I completion contract preserves the three-part fields. The archived MIMIC-IV completion contract in Table S13 does not return confidence or separate literature-bridge and exact-mapping flags and therefore cannot, by itself, establish passage through the default gate. It is retained as legacy provenance rather than a second registered gate; a release using the uniform gate must rejudge those fixed completion proposals under the default three-part schema. The accepted set is C (2) i ⊆ e C (2) i . The graph contains exactly two bounded iterations, with discovery and validation retrieval occurring inside Iteration 2. Research pool and its two ranking views. Under the main-paper information boundary, the complete research candidate pool is C R i =V d B i ∪ C (1) i ∪ C (2) i .(16) Only accepted additions augment the EHR Prior. The pool is deterministically hash-shuffled before model ranking and capped at 60 candidates; the randomized display order prevents the ranker from exploiting construction order. Equation 16 is patient-local: it excludes any fill or query choice computed from other evaluation patients. Frequency-related field names in legacy selector schemas are retained only for artifact compatibility. An archived candidate state populated by a cohort-level frequency fill does not satisfy this method contract and must be regenerated before it can be used as a release output. The ranking agent receives H i and one candidate packet for every c ∈ C R i . A packet contains the canonical code and title, provenance, temporal class, patient clue, transition hypothesis, retrieval state, and zero or more candidate-bound evidence records, with at most two excerpts shown to the ranker. It assigns a confidence score ψ i (c) ∈ [0, 100] to every candidate and emits a patient-specific end-of-vector threshold η i . Sorting all candidates by decreasing ψ i (c), with canonical code identity as the deterministic tie-breaker, gives the complete research ordering ̄ R i = ( ̄r i1 ,..., ̄r i|C R i | ).(17) The thresholded research branch list is the order-preserving subsequence R i = c∈ ̄ R i : ψ i (c)≥ η i .(18) This distinction resolves two uses of the ranking output: exact-K Research Path Only evaluation takes the leading K entries of the complete ordering ̄ R i , whereas RRF receives the thresholded branch list R i . A member ofC R i \ set(R i ) remains available to the Evidence-Aware Reranker and the frozen union pool but has no research-rank contribution in RRF. Final Selection Final Selection maps the EHR-Prior-initialized research state and complementary Direct Forecast ranking to one ordered forecast. The experiments compare two selector implementations over the same per-patient proposal state. ICD-Deepresearch w/o Evidence-Aware Reranker. For each registered artifact, dictionary validation freezes the union C U i =V d C R i ∪ set(D i ) .(19) Together with the EHR Prior, branch rankings, ledger, and candidate-keyed metadata, this pool forms the frozen, target-blind proposal artifact A frz i = π F i ,C U i ,D i , ̄ R i ,R i ,L (2) i ,M i .(20) Here, “frozen artifact” means the per-patient proposal state saved before selector comparison; it is distinct from the Candidate Generation seed set B i . At freeze time, M i contains the candidate identifier and title, provenance flags, raw direct and research scores, temporal class, patient clue, transition hypothesis, metadata warnings, source-support status, and ledger join keys. The EHR-Prior native rank is the position in π F i ; direct and research ranks are positions in D i , ̄ R i , and R i ; pre-target occurrence metadata are computed deterministically from H i . Consequently, the full selector receives exactly (H i ,A frz i ), with no target- derived field. For code c, let r R i (c) and r D i (c) be its one-based ranks when present in R i and D i , respectively. Reciprocal-rank fusion assigns s RRF i (c) = I[c∈ R i ] k 0 + r R i (c) + I[c∈ D i ] k 0 + r D i (c) , k 0 = 60.(21) Here, I[·] is the indicator function, and a branch contribution is zero when c is absent from that branch. Codes inC U i are sorted by decreasing s RRF i (c), with canonical code identity as the deterministic tie-breaker, to yield the complete ranking π RRF i . The leading K codes form b Y RRF,(K) i . A code supported by both branch lists receives two reciprocal-rank contributions; a branch-exclusive code can still enter when its within-branch rank is high. RRF is deterministic, uses only the finalized branch rankings, and does not interpret branch scores as comparable probabilities. Saved artifacts call this selector AF/Union+RRF. Evidence-Aware Reranker (full ICD-Deepresearch). The full selector receives H i and the same A frz i and scores every candidate inC U i . Candidate display order is deterministically randomized. For each candidate, the selector receives canonical identity, provenance, EHR Prior rank and pre-target-occurrence metadata, direct and research ranks, temporal class, patient clue, transition hypothesis, source-support status, and retained source records. The selector assigns φ i (c) ∈ [0, 100] together with categorical patient-anchor strength, exact-code support, and a reason tag. It prioritizes patient-specific support over generic prevalence: external relation evidence contributes only through a patient anchor, while research-only, family-level, and patient-unanchored candidates receive lower suggested score ceilings. Candidates are ordered first by decreasing φ i (c), then by direct rank, research rank, and canonical code identity, yielding π full i . Its leading K codes define b Y full,(K) i . The full–RRF contrast therefore changes only the selection rule conditional on the same frozen candidate state. Saved implementation artifacts call the Evidence-Aware Reranker FR and its earlier runner Stage A v2. Symbol summary. H i , π F i , B i , and Y i are the pre-target record, ordered EHR Prior, its seed set, and the held-out target in Ω d ;V d is deterministic vocabulary validation. In x = (c,z,a,ℓ,o,u,q), c/z identify the code and term, a is the patient anchor, ℓ the temporal class, o the ongoing-evidence flag, u the transition claim, and q the query; κ projects a proposal record to its code. Ledger record e additionally stores engine g, source metadata σ, excerpt ξ, and automatic support cue b. e C (r) i and C (r) i are the dictionary-valid proposals and accepted additions in iteration r, Q (2) i contains Iteration 2 discovery queries, and L (r) i is the ledger accumulated through iteration r.C R i is the complete research pool, ̄ R i its complete ordering, R i its EOV-thresholded RRF branch list, and D i the Direct Forecast ranking. Their union isC U i , andA frz i bundles the EHR Prior, union, branch rankings, final ledger, and candidate-keyed metadata M i before selector comparison. Gate confidence γ (2) i (c)∈ [0, 1] is distinct from the research and selector ranking scores ψ i (c),φ i (c) ∈ [0, 100]. The RRF and full selectors map the same artifact to π RRF i and π full i . In main-paper Figure 2, S t denotes the displayed source set after a within-iteration search/read step, E t the accumulated evidence bank, and ∆E t newly merged evidence; S n+1 ,S n+2 ,... denote newly retrieved follow-up sources, where n is the current source count. The displayed C t and τ summarize a verification score and its candidate-acceptance threshold; the executable gates are the Iteration 1 acceptance verdict, the Iteration 2 three-part verdict with confidence at least 0.68, and the research ranker’s EOV threshold η i , as specified above. The main paper is the authoritative source for the reader-facing method, information boundary, component names, evaluation contracts, and reported claims. This supplement unrolls the corresponding executable operations and retains historical labels only where needed to trace archived artifacts. Post-Selection Explanation Module (RRF-Selected Audit) After the ICD-Deepresearch RRF-selected prefix is finalized, the explanation writer returns exactly one structured record for every selected code and preserves code identities and order. The saved implementation labels this selector AF/Union+RRF. The writer receives H i , the selected canonical code and title, candidate-specific clues, and only the frozen ledger records assigned to that code. Each output contains a patient-specific rationale, an explicit uncertainty statement, and code-bound citation identifiers; structural validation requires every selected code exactly once. Each rationale separates four links: the observed patient anchor, any source-supported population-level relation, the exact ICD meaning, and the hypothesis that the code may be documented at the next encounter. Definition references establish code identity. Independent relation sources support only claims entailed by their retained excerpts, and H i supplies patient applicability. Acute diagnoses, abnormalities, injuries, and encounter-context codes remain conditional on persistence or recurrence. Bracketed citations resolve to a numbered list containing retrieval engine, stable identifier when available, title, URL, source type, and query. Explanation generation uses the finalized prediction and leaves prediction metrics unchanged. Accordingly, the reported explanation audit evaluates RRF-selected outputs, not the full Evidence-Aware selector. Retrospective Proposal Diagnostics The natural-cardinality diagnostic examines accepted Research Expansion additions before fixed-budget top-K ranking. Let P (0) i = B i , P (1) i = B i ∪ C (1) i , and P (2) i = P (1) i ∪ C (2) i . For iteration r ∈1, 2, the additions are A (r) i = P (r) i \ P (r−1) i , and their observed target-match rate is ρ (r) = P i |A (r) i ∩ Y i | P i |A (r) i | .(22) Let the current cohort output contain N pred predictions and N hit target hits across N gold target codes. Adding N add > 0 predictions with N match target matches improves pooled F1 exactly when F1 new > F1 current ⇐⇒ N match N add > N hit N pred + N gold = F1 current 2 .(23) The equivalence follows by cross-multiplying 2(N hit +N match )/(N pred +N add +N gold ) > 2N hit /(N pred +N gold ). It applies to pooled micro-F1; patient-macro F1 weights the same additions differently. Both ρ (r) and the break-even condition are retrospective diagnostics computed only after forecasts are finalized. The registered executor itself remains fixed at two Research Expansion iterations followed by the selector described in Section S3. S3 Full Experimental Protocol Study Design The unit of analysis is a patient trajectory ending immediately before a held-out encounter. RQ1 compares ICD-Deepresearch: Candidate Generation Only, ICD-Deepresearch: Direct Forecast Only, ICD-Deepresearch: Research Path Only, ICD- Deepresearch w/o Evidence-Aware Reranker, and the full ICD-Deepresearch system. GPT-5 + Web Search (Standalone) and Medical Deep Research (Standalone) are external search-enabled comparators (Clinical-Copilot 2026). RQ2 evaluates iteration-level expansion and research context under a fixed candidate pool. RQ3 evaluates retrieved sources and operational efficiency, and RQ4 evaluates post-selection explanations. Primary forecasting uses the completed MIMIC-I and MIMIC-IV scale exports, whereas component and selector analyses use separately registered diagnostic cohorts. Results are compared only within the same table, dataset, patient set, target construction, and metric contract. Table S1 records the controlled state for each functional and audit analysis. The protocol uses the same four components as the method. Candidate Generation returns the ordered EHR Prior π F i and its seed set B i ; Direct Forecast returns the independent ordering D i ; and EHR-Prior-initialized Research Expansion returns the validated poolC R i , its complete ordering ̄ R i , its EOV-thresholded RRF branch list R i , the final ledger L (2) i , and candidate metadata M i . Research Path Only evaluates the leading K entries of ̄ R i ; Union+RRF uses R i as its research branch; and the full Evidence-Aware Reranker scores the complete validated union C U i . GPT-5 + Web Search (Standalone) directly emits a forecast after required tool use; the adapted Medical Deep Research comparator converts its standalone investigation into an ICD ranking without access to the ICD-Deepresearch candidate state. EHRSHOT transfer and marginal-yield accounting characterize Research Expansion before fixed-budget selection. Reproducibility records retain the internal labels FCG/DCG/DR-CG/JCS and the legacy selector labels AF/FR. Cohorts and Outcome Construction MIMIC-I uses each patient’s final admission and all unique ICD-9-CM diagnoses on that admission as the target (Johnson et al. 2016). MIMIC-IV uses the corresponding final-admission construction with unique ICD-10-CM diagnoses (Johnson et al. 2023). For both ICD tasks, SparseEHR provides the learned structured-EHR backbone of Candidate Generation (Ghaffari et al. 2026). The complete module also supplies the task-specific target-vocabulary interface and registered ranked export (internal label FCG) consumed by all downstream analyses. For the EHRSHOT mixed-vocabulary diagnostic, the conditional candidate generator decodes directly into the native event-code vocabulary from the structured pre-target record. In this manuscript, scale cohort denotes every trajectory in the final registered primary-evaluation export: all 7,496 eligible MIMIC-I trajectories and the completed 62,537-trajectory MIMIC-IV execution. The local block in main-paper Table 1 uses these scale cohorts and the patient-averaged exact-K contract in Equation 25. These values are not compared numerically with the subset results in the component table. The registered component and selector comparison uses one development-disjoint random MIMIC-I diagnostic cohort (n = 100) and one frozen-order MIMIC-IV diagnostic cohort (n = 100). Within each dataset, Panels A–B use the same frozen patient identifiers and target sets for every configuration. Each configuration is executed independently three times under the same K = 20 evaluation contract. Patient membership and the pooled gold count G are therefore fixed across configurations and repetitions; only the predicted rankings may vary. The sample size n = 100 is the number of unique patients per run, not 300 patients after concatenating repetitions. Table entries are arithmetic means of the three run-level metric exports. The fixed-pool selector audit uses a separately registered n = 100 cohort per dataset and the same three-run aggregation. Within each repetition, all fixed-pool arms receive identical candidate identities and randomized display order; only the delivered research context or selector backend changes. A trajectory is not removed because one system lacks a valid ranking. Missing or malformed rankings are rerun before evaluation so that each configuration contributes the same 100 patients in every repetition. Iteration, source, efficiency, and explanation analyses use their stated 100-patient snapshots unless another sample size is explicitly given. Table S1. Protocol and analysis registry. The scale-cohort primary forecasting analysis and the subset diagnostic analyses are distinct evaluation contracts. Data, controlled state, metric, and estimand are shown for each analysis. AnalysisData and compared functions Controlled state and metricEstimand Primary forecastingMIMIC-I/IV scale cohorts: ICD-Deepresearch: Candidate Generation Only, GPT-5 + Web Search (Standalone), and full ICD-Deepresearch Complete exact-K rankings at K ∈10, 20; patient-averaged P@K/R@K System-level forecasting performance Component and selector controls Diagnostic cohorts (n = 100 per dataset): Candidate Generation Only, Direct Forecast Only, Research Path Only, ICD-Deepresearch w/o Evidence-Aware Reranker, and full ICD-Deepresearch Same frozen patient IDs and targets; three independently executed K = 20 runs; mean pooled micro-P/R/F1 and mean patient-macro F1 Contribution of candidate paths and selector choice within each diagnostic cohort External comparators Diagnostic cohorts (n = 100 per dataset): GPT-5 + Web Search (Standalone) and Medical Deep Research (Standalone) Same patient IDs, targets, failure policy, and three-run K = 20 contract as the corresponding component rows; no ICD-Deepresearch internal state Search-enabled forecasting under each recorded policy Fixed-pool selector control Separate n = 100 cohort per dataset; candidate IDs with versus without Research Expansion context Within each run, the same patient IDs, candidate IDs, randomized order, backend, and K = 20; three independently executed runs and mean pooled micro and patient-macro metrics Contribution of the delivered research packet after candidate generation Iteration diagnosticResearch Expansion and retention rules Common diagnostic snapshot and target construction Coverage–cardinality and support-score behavior Source auditResearch Expansion, GPT-5 + Web Search (Standalone), and Medical Deep Research (Standalone) Source-occurrence sampling and blinded labels Composition and clinical usefulness of retrieved documents Efficiency auditMatched 100-patient Research Expansion and GPT-5 + Web Search cohorts Same patient IDs; per-patient telemetry; pooled micro-F1@20 Queries, retrieval operations, source access, visible tokens, throughput, cost, and forecasting performance Reason auditICD-Deepresearch (RRF-selected) and direct models at K = 20 Predictions finalized before evaluation Explanation alignment, calibration, and safety Target codes enter only after prediction finalization. Each processing stage normalizes and deduplicates code strings, and the evaluation script verifies that every fixed-budget output supplies at least 20 unique, target-vocabulary-valid codes before taking its exact-K prefix. Primary Comparison and Method-Aligned Ablations The main paper separates two protocol blocks. The published-reference block identifies CAML, ZAGCNN, GatorTron, Distil- BioBERT, Chet, DKEC, and BioMedLM (Mullenbach et al. 2018; Rios and Kavuluru 2018; Yang et al. 2022; Rohanian et al. 2023; Lu, Han, and Ning 2022; Ge et al. 2024; Bolton et al. 2024); its numerical values and THCM-CAL row are transcribed from THCM-CAL Table 2 (Zhang et al. 2025). The local block reports ICD-Deepresearch: Candidate Generation Only, GPT-5 + Web Search (Standalone), and full ICD-Deepresearch under our target construction. Each complete local ranking is evaluated at K = 10 and K = 20. Panel A of Supplementary Table S2 reports ICD-Deepresearch: Candidate Generation Only, ICD-Deepresearch: Direct Fore- cast Only, ICD-Deepresearch: Research Path Only, ICD-Deepresearch w/o Evidence-Aware Reranker, and full ICD-Deepresearch on both diagnostic cohorts. Research Expansion is initialized by B i ; Final Selection combines its finalized state with the Direct Forecast. Panel B reports GPT-5 + Web Search (Standalone) and Medical Deep Research (Standalone) under the same within- dataset cohort and pooled exact-20 contract. Panel C fixes the candidate pool, randomized display order, and GPT-5 selector, then varies the Research Expansion context packet. Its target-conditioned pool oracle bounds selection within the observed pool. Panel C is a separate fixed-pool diagnostic and is not compared numerically with Panels A–B. Baseline prompts and retrieval budgets. The Direct Forecast and GPT-5 + Web Search prompts were refined under the same target-blind development protocol. Both specify the next-encounter horizon, target-code system, exact-code specificity, uncertainty handling, structured output, and validation retries. Web Search additionally requires tool use, permits a self- selected uncapped search count, and requests an exhaustive ranking. The recorded source artifacts contain 13,394/37,724/1,410 result occurrences on MIMIC-I and 25,100/37,989/11,124 on MIMIC-IV for GPT-5 + Web Search (Standalone), Medical Deep Research (Standalone), and Research Expansion, respectively; the corresponding unique-URL counts are 6,363/26,268/1,246 and 12,589/28,072/9,178. Medical Deep Research is an open-source multi-agent investigation workflow with planning, specialized medical retrieval, analysis, and report generation (Clinical-Copilot 2026); the reported comparator is its task-specific adaptation to pre-target ICD ranking. ConfigurationPrompt safeguardsRetrieval/output policyRole Candidate Generation (SparseEHR backbone; internal FCG) Structured pre-target EHR, registered target vocabulary, target-blind inference Ordered candidate decoding in ICD-9-CM/ICD-10-CM; native-vocabulary decoding for other structured code targets Method component Direct Forecast (internal DCG) Next-encounter horizon, exact target-code system, pre-target inputs, structured retries Bounded ranking from the pre-target record Method component GPT-5 + Web Search (Standalone) Same task safeguards plus mandatory Web Search Self-selected searches, uncapped search count, exhaustive ranking External comparator Medical Deep Research (Standalone) Pre-target forecasting question and target ICD system Multi-agent medical retrieval and report workflow adapted to an ICD ranking External comparator Research Expansion (internal DR-CG) Patient-anchor/query state, dual-channel tools, reading, memory, verification, feedback, ranking Fixed two-iteration executor with bounded query/page/candidate state Method component The full ICD-Deepresearch pass and RRF-fusion–full-model comparison use the same precomputed, target-blind candidate states. Natural-cardinality diagnostics evaluate Research Expansion before a fixed output budget. Retention rules start from a common research state and retain follow-up additions by support score or source-availability criteria; evaluation labels are applied after each rule produces its output. Implementation Record Candidate Generation uses SparseEHR as its structured-EHR backbone on the primary ICD tasks. Its registered outputs include the ordered candidate codes and native ranks used to initialize Research Expansion and to report the Candidate Generation Only control. The SparseEHR architecture and training procedure are described in the cited work; the paper’s replay artifacts retain the complete internal FCG interface seen by downstream components. For both primary evaluations, the full ICD-Deepresearch Evidence-Aware Reranker loads each registered combined candidate state, randomizes displayed candidate order, scores every candidate with GPT-5, and saves a complete ranking. The release audit verifies trajectory coverage, contiguous candidate ranks, unique normalized codes, candidate-count consistency, target-use flags, and exact reproduction of the reported metrics. The corresponding runners retain the legacy JCS-FR/FR labels. The executor runs the Direct Forecast and Iteration 1 Research Expansion planning concurrently, permits bounded Iteration 1 and follow-up hypotheses, retains a bounded number of readable items from each retrieval channel per query, and constructs the target-vocabulary-valid candidate pool. The online channel uses live Google SERPs through SearchCans; Google search is serialized and rate-limited, and URL reading is parallelized. The offline channel searches fixed PMC and arXiv snapshots. Both channels record engine-specific success and failure states before evidence merge. The 100-case MIMIC-IV mechanism snapshot uses ICD-Deepresearch w/o Evidence-Aware Reranker with k 0 = 60. The archived MIMIC-IV selector record (legacy artifact label JCS-FR) uses gpt-5-2025-08-07, medium reason- ing effort, prompt-version identifier source_aware_confidence_v2_acute_preserving_icd10_frequency_ fixed, and seed 20260729. The literal identifier is retained for traceability; frequency-related tokens are legacy schema names and do not override the patient-local information boundary in Section S2. Any artifact that actually populated a cross- patient frequency fill is excluded by the release contract in Equation 16. The earlier MIMIC-IV iteration analysis uses its archived candidate and query budgets. The remaining K = 20 audits use gpt-5-2025-08-07, gpt-4o-2024-08-06, and gpt-4o-mini-2024-07-18 (OpenAI 2025, 2024b,a); the explanation judge uses the GPT-5 snapshot. The diagnostic experiments in Supplementary Table S2 comprise three independently executed runs for each configuration on the same registered 100-patient cohort per dataset. The model snapshot, prompt version, frozen patient manifest, target construction, output budget, and decoding configuration are held fixed across repetitions. The release manifest retains the three run identifiers, complete outputs, and any backend seed exposed for each run. The seed reported above identifies the scale-cohort MIMIC-IV release rather than the three diagnostic repetitions. Metrics, Inference, and Audit Protocol We report patient-averaged top-K metrics and pooled micro metrics as separate evaluation contracts. LetI be the frozen patient set for one dataset and analysis block, let n =|I|, and, for a fixed budget K, define h i,K =| b Y (K) i ∩ Y i |, T K = X i∈I h i,K , G = X i∈I |Y i |. (24) Main-paper Table 1 uses the patient-averaged exact-K quantities P@K = 1 n X i∈I h i,K K , R@K = 1 n X i∈I h i,K |Y i | . (25) Each registered primary output supplies an exact-K prefix. Under this contract, patient-averaged P@K is algebraically equal to T K /(nK), whereas patient-averaged R@K gives each patient equal weight and generally differs from pooled recall. The main-paper component table and Supplementary Table S2 use pooled counts for the columns labeled Micro: Micro-P@K = T K nK ,Micro-R@K = T K G , Micro-F1@K = 2T K nK + G , Macro-F1@K = 1 n X i∈I 2h i,K K +|Y i | . (26) For the repeated diagnostic experiments, letS =1, 2, 3 index the independently executed runs, let h (s) i,K =| b Y (K) i,s ∩ Y i |, and let each run-level metric M (s) be computed using Equation 26 with h (s) i,K and T (s) K = P i∈I h (s) i,K . The reported three-run mean is M = 1 |S| X s∈S M (s) , |S| = 3.(27) Here n = 100 is the per-run number of unique patients;I, n, and G do not change across configurations or runs. Each diagnostic row is auditable from the three run manifests and their run-level metrics. Table entries and between-system differences are displayed to two decimal places. The primary P@K/R@K values are not combined to infer micro-F1, because patient-averaged recall generally differs from pooled recall. For a variable-cardinality candidate set C i , the same definitions replace K by |C i | in each patient-level precision or F1 denominator and replace nK by P i∈I |C i | in the pooled precision and F1 denominators. The legacy table label Ex-F1 denotes this patient-averaged (macro) F1; it is not exact-match accuracy. Likewise, example recall denotes patient-averaged recall and is distinct from pooled micro-recall. The displayed names in this supplement are Patient-macro F1 and Patient-averaged recall, respectively. Reason quality is evaluated on five 0–5 dimensions: clinical validity, patient grounding, next-encounter relevance, exact ICD alignment, and evidential calibration. For a configuration evaluated at budget K, let ̄q ic be the arithmetic mean of these scores for a true-positive patient–code pair and define U K = X i∈I X c∈ b Y (K) i ∩Y i ̄q ic 5 ,CA-RQ5 = 5 2U K P i∈I | b Y (K) i | + P i∈I |Y i | .(28) A true positive contributes its normalized reason quality; false predictions and missed targets contribute zero within the soft-F1 denominator. CA-RQ5 is reported on a 0–5 scale at K = 20. Stage-wise paired intervals use patient-cluster bootstrap resampling. For a repeated-run paired contrast, the same resampled patient identifiers are applied to both systems and all three outputs for each sampled patient are retained; the run-averaged paired contrast is recomputed in each bootstrap replicate. Explanation intervals resample the 100 finalized cases per dataset, and addition-yield intervals resample patients with complete batches. Exact two-sided sign tests compare improved and worsened Iteration 2 cases after excluding ties. Retrieved-Source Metadata and Physician Audit The source audit characterizes domains and metadata of recorded retrieval outputs on a 100-patient snapshot from each MIMIC cohort. For GPT-5 + Web Search (Standalone), Medical Deep Research (Standalone), and Research Expansion, it extracts recorded URLs, deduplicates exact URLs within patient, and removes deterministic post-hoc ICD dictionary citations. Source classes are peer-reviewed biomedical literature, medical government or official sources, clinical or professional references, coding references, preprint repositories, forums, and other Web pages. For each system–dataset cell, metadata and physician screening sample 50 source occurrences from cases with recorded sources. The GPT-5 metadata judge receives the pre-target record, retrieval query, page title, and URL and assigns medical- support and immediate-forecast-usefulness labels. Two physicians independently assign a binary usefulness label to every sampled document. The reported physician usefulness rate is the arithmetic mean of the two physician-specific 50-document rates. The audit unit is a retrieved source occurrence, and the main-paper table is the authoritative source for all counts and rates. Online-Retrieval Efficiency Accounting The efficiency analysis uses matched 100-patient prediction cohorts within MIMIC-I and MIMIC-IV and normalizes opera- tional quantities by the common matched-cohort size. For GPT-5 + Web Search (Standalone), unique queries are deduplicated within patient, retrieval operations are Web Search tool calls, and source accesses are URL occurrences returned by the retained successful response. Its token and cost fields use retained API usage records. For Research Expansion, queries are candidate- conditioned query strings, retrieval operations are scheduled online or offline retrieval actions, and source accesses are explicit Reader attempts. Visible tokens reconstruct prompts, JSON schemas, and returned text with o200k_base; hidden reasoning tokens were not stored. Throughput is observed batched-campaign throughput rather than single-patient latency. Micro-F1@20 uses pooled counts on the same matched patient IDs used for telemetry. The two telemetry paths do not establish a common end-to-end LLM-call event: attempted calls, successful responses, retained usage records, nested calls, and retries are not represented identically. The efficiency table therefore omits the archived request-like field and does not compare total model-call counts. Explanation Evaluation The primary explanation experiment uses a K = 20 snapshot of ICD-Deepresearch (RRF-selected; AF/Union+RRF in the saved records), GPT-5 (Direct), GPT-4o (Direct), and GPT-4o-mini (Direct). Each direct backend first generates its ranking from H i , then explains its selected codes from H i , code identity, rank, and saved ranking score. ICD-Deepresearch (RRF-selected) explains its finalized selection from H i , canonical code information, candidate clues, and code-bound ledger entries. The evaluation script identifies true-positive reason items, pools them within patient, assigns opaque item identifiers, and shuffles them. A GPT-5 judge receives the pre-target trajectory, complete gold set, and anonymous items. The item presentation omits method identity, prediction rank, confidence, complete prediction set, and method-level TP/FP/FN counts. Scores use a shared 0–5 anchor: 5 complete and precise, 4 strong with one minor limitation, 3 plausible but partial, 2 major gaps or mismatch, 1 materially misleading, and 0 absent, contradicted, or unusable. Clinical validity assesses medical soundness; patient grounding assesses support in the pre-target trajectory; next-encounter relevance assesses the immediate forecasting bridge; ICD alignment assesses exact entity and specificity; and evidential cali- bration assesses separation of observed facts, general knowledge, cited relations, hypotheses, and uncertainty. Own-TP means summarize each system’s correct predictions. Shared-hit differences compare identical patient–code pairs. Equation 28 combines prediction-set coverage with reason quality for the complete K = 20 output. S4 Additional Results and Diagnostics Component, Selector, and Fixed-Pool Controls (Main RQ1–RQ2) Table S2 separates isolated path controls from registered joint-selector outputs. Panel A compares Candidate Generation Only, Direct Forecast Only, and Research Path Only with two joint selectors: ICD-Deepresearch w/o Evidence-Aware Reranker (RRF) and the full ICD-Deepresearch system (Evidence-Aware). Panel B reports the standalone research comparators. Panel C fixes candidate identities and randomized display order within each run while varying the research context delivered to the selector or its language-model backend. These diagnostic-cohort values are interpreted within each dataset block and are not substituted for the scale-cohort results in the main table. Within MIMIC-I, ICD-Deepresearch is +4.02, +3.69, +4.98, and +2.52 micro-F1 points above Candidate Generation Only, Direct Forecast Only, Research Path Only, and ICD-Deepresearch w/o Evidence-Aware Reranker, respectively. It is +2.41 points above GPT-5 + Web Search (Standalone), and the joint-pool oracle is a further 8.28 points higher. On MIMIC-IV, ICD-Deepresearch reaches 35.44 micro-F1: +4.08 above Direct Forecast Only, +2.54 above Research Path Only, +0.59 above the RRF selector, and +2.07 above GPT-5 + Web Search (Standalone). Medical Deep Research reaches 21.08/15.74 micro-F1 on the MIMIC-I/MIMIC-IV diagnostic cohorts. Except for contrasts accompanied by an interval below, these are descriptive differences between five-run mean point estimates; they are not claims of statistical significance. Research-round expansion and retention diagnostics. The natural-cardinality traces show that bounded expansion can recover additional targets while enlarging the candidate state. On EHRSHOT, the two research rounds recover 144 additional held-out matches, but mean set size more than doubles and micro-F1 falls from 25.82% to 16.34%. The retrospective marginal- yield analysis in Figure S2 shows that initial expansion clears the micro-F1/2 boundary on the two MIMIC diagnostics, whereas Research Round 2 falls below it in all three settings. The support-score rule retains 21 of 28 Research Round 2 matches while reducing candidate growth; source-availability rules retain fewer matches. These results motivate development and prospective evaluation of a state-aware retention policy. Fixed-Pool Research-Context Control (Main RQ2) Panel C of Table S2 fixes the target-blind candidate pool, randomized display order, and evaluation budget K = 20. Relative to the ICD-Deepresearch w/o Research Context (Fixed Pool; GPT-5) arm, the research-context configuration changes mean micro-F1 by +0.12 points on MIMIC-I (95% CI−1.12 to +1.33) and +1.90 points on MIMIC-IV; the latter is a descriptive point estimate because no interval is available in the archive. Comparisons with GPT-4o and GPT-4o-mini additionally vary the selector backend. The matched GPT-5 contrast measures the delivered research packet after proposal generation and does not isolate Research Expansion’s effect on candidate identities. RQ3: Research Expansion Source Quality The main paper reports the complete source composition, metadata audit, and physician evaluation. This supplement provides the protocol, judge prompt, and paired retrieval traces. Each system–dataset cell contains 50 sampled source occurrences; two physicians independently rated every sampled document, and the table reports the mean of their binary usefulness rates. GPT-5 + Web Search (Standalone) records 9.5×/5.1× more uses/unique URLs on MIMIC-I and 2.3×/1.4× more on MIMIC-IV. Medical Deep Research records 37,724/37,989 uses and 26,268/28,072 unique URLs on MIMIC-I/IV. It has the highest MIMIC-I peer-reviewed share and forecast proxy (44.2% and 34%), whereas Research Expansion has the highest support proxy on both datasets (62%/64%) and the highest MIMIC-IV forecast proxy (36%). Physicians rate 32%/41% of Medical Deep Research documents useful, compared with 51%/68% for Research Expansion. The proxy–physician divergence motivates reporting both assessments. RQ3: Research Expansion Efficiency Table S4 reports matched-cohort operational accounting. Research Expansion uses 7.3×/3.4× fewer unique queries, 3.8×/4.5× fewer source accesses, and 6.1×/2.9× fewer visible tokens per patient on MIMIC-I/IV. Its recorded batched throughput is 16.8×/21.9× higher. The visible-token cost ranges are $0.020–0.039 and $0.021–0.049 per patient, compared with $0.458 and $0.317 for GPT-5 + Web Search (Standalone), while matched-cohort micro-F1@20 is 26.4 versus 30.2 and 33.3 versus 34.8, respectively. Research Expansion records more fine-grained retrieval operations because its scheduler executes candidate- conditioned online/offline retrieval and reading steps; the source-access and token columns capture the smaller downstream footprint of those operations. Table S4. Online-retrieval efficiency on the matched prediction cohorts. Operational quantities are normalized per patient. DatasetSystemN Queries /pt Retrieval ops /pt Source access /pt Tokens /pt Observed pt/hour Cost /pt Micro- F1@20 MIMIC-I GPT-5 + Web Search (Standalone) 10055.119.5134.2 110.0k10.9$0.45826.4 MIMIC-I Research Expansion1007.651.535.7 ≈18.1k182.6 $0.020–0.039 † 30.2 MIMIC-IV GPT-5 + Web Search (Standalone) 10037.812.8251.0 77.3k12.9$0.31733.3 MIMIC-IV Research Expansion10011.078.755.8 ≈26.4k282.7 $0.021–0.049 † 34.8 Accounting. For GPT-5 + Web Search (Standalone), queries are unique within patient, retrieval operations are web-search tool calls, and source accesses are URL occurrences returned by the retained successful Response. Its token and cost fields come from retained API usage and include GPT-5 plus web-search-preview calls. Total LLM-call counts are omitted because the two telemetry paths do not define the same end-to-end event. Research Expansion source accesses are explicit Reader attempts, and its SearchCans marginal cost is $0 under the account used here. Research Expansion tokens reconstruct GPT-5 prompt payloads, JSON schemas, and visible outputs with o200k_base; hidden reasoning tokens were not saved. Accordingly, † gives the visible-token cost range from all-cached to all-uncached input and excludes hidden reasoning. Throughput describes recorded batched campaigns rather than single-patient latency. MIMIC-I standalone web-search source-metadata capture was incomplete. Micro-F1@20 uses pooled counts under the same 20-slot rule. RQ4: Post-Selection Semantic and Safety Audit The main paper reports the Reason5/CA-RQ5 visualization and interpretation. The supplement provides exact plotted values, the judge contract, and complete positive and negative case traces. Shared-hit matching fixes patient–code identity across systems. On 441 MIMIC-I shared hits, the automated GPT-5 judge scores ICD-Deepresearch (RRF-selected) 0.07 points higher on ICD alignment (95% CI +0.02 to +0.12) and 0.22 points higher on evidential calibration (+0.15 to +0.29). On 479 MIMIC-IV shared hits, its automated scores are higher for clinical validity, patient grounding, ICD alignment, and calibration; the next-encounter relevance difference is +0.03 (95% CI−0.04 to +0.08). At cohort level, CA-RQ5 changes from 1.29 to 1.33 on MIMIC-I (95% CI −0.02 to +0.09) and from 1.36 to 1.57 on MIMIC-IV (+0.15 to +0.27). Independent clinical-relation sources are present for 58 of 499 (11.62%) MIMIC-I and 8 of 577 (1.39%) MIMIC-IV ICD-Deepresearch (RRF-selected) true-positive explanations. The remaining citations primarily resolve code identity or provide other non-relation support; complete case traces appear in Sections S8–S9. FCGDR-CG Iter. 1DR-CG Iter. 2 0 10 20 30 40 50 60 Recall on held-out native codes (%) 49.2% 56.2% 57.6% 42.4% 52.2% 56.2% (a) Native-vocabulary candidate coverage Example recallMicro recall FCGDR-CG Iter. 1DR-CG Iter. 2 0 10 20 30 40 50 60 Mean candidate-set size 19.8 44.2 51.0 +102 held-out gold matches +42 held-out gold matches (b) Candidate-state growth and discoveries EHRSHOT transfer: candidate expansion over the native event-code vocabulary (n= 120) Figure S1. EHRSHOT candidate-generation trajectory at natural cardinality (n = 120). (a) Patient-averaged and micro recall across EHR Prior, Research Round 1, and Research Round 2; labels report newly matched targets. (b) Mean candidate-pool size over the same states, characterizing the coverage–cardinality trade-off before final selection. MIMIC-I initial MIMIC-I follow-up MIMIC-IV initial MIMIC-IV follow-up EHRSHOT initial EHRSHOT follow-up 0 5 10 15 20 25 30 35 Target-matched additions (%) 30.6% 38/124 8.0% 7/87 22.6% 362/1603 13.0% 28/216 3.5% 102/2926 5.1% 42/818 Error bars: patient-bootstrap 95% CI (10,000 resamples); not available for MIMIC-I yield. a Marginal yield crosses the exact boundary Δmicro-F1 > 0 Δmicro-F1 ≤ 0 required yield = current micro-F1/2 −10−50510 Δmicro-F1 (percentage points) M-I init M-I follow M-IV init M-IV follow EHR init EHR follow +3.06 -0.98 +9.04 -0.004 -8.70 -0.78 b The boundary predicts 6/6 signs Figure S2. Bars show target matches per added candidate, and horizontal markers show the state-dependent micro-F1/2 requirement (MIMIC- I n = 100, MIMIC-IV n = 100, EHRSHOT n = 120). Green batches exceed the algebraic marginal-yield boundary and red batches fall below it. The figure decomposes finalized outputs; error bars are patient-cluster bootstrap intervals for MIMIC-IV and EHRSHOT. This is an automated, gold-aware semantic audit rather than independent clinical validation: GPT-5 receives the complete held-out gold set only after all predictions and explanations are frozen, evaluates shuffled true-positive reason items, and does not see method identity. GPT-5 also generates several compared outputs, so judge–generator dependence remains a limitation. Secondary Diagnostics EHRSHOT native-vocabulary transfer. On this 120-case transfer sample, Research Rounds 1–2 recover 144 additional held-out matches beyond the EHR Prior in the native mixed event-code vocabulary. Mean set size more than doubles and micro-F1 changes from 25.82% to 16.34%. Figure S1 reports the research-round coverage–cardinality trajectory; Figure S2 compares each addition batch with its state-dependent algebraic boundary. The opposing recall and F1 directions motivate the fixed-budget selector and the post-hoc marginal accounting below. Post-hoc marginal-yield accounting. Figure S2 uses observed targets to compare each addition batch with the current micro- F1/2 boundary. The calculation is an algebraic accounting identity applied to finalized outputs. Initial expansion clears the boundary on both MIMIC diagnostics but not on EHRSHOT; Research Round 2 falls below it on all five. MIMIC-IV Research Round 2 is the near-boundary case: its 12.96% yield is just below the 13.01% requirement, and micro-F1 changes by only −0.004 points. The aggregate mean masks concentrated Research Round 2 matches. MIMIC-IV Research Round 2 raises patient-level F1 for 13 patients, leaves 35 tied, and lowers it for 52 (p = 1.17× 10 −6 , unadjusted two-sided sign test); its 13 improved cases contain 26 of 28 added matches. EHRSHOT raises patient-level F1 for 7, leaves 38 tied, and lowers it for 75 (p = 1.73× 10 −15 ). These post-hoc counts motivate a held-out retention-policy experiment. Patient-anchor verification requirement. The complete saved traces expose unsupported patient facts, including an LDL value of 162 mg/dL, atorvastatin use, prolonged heartburn, daily omeprazole, and years of low-back pain. These facts are absent from the structured pre-target input, while the accompanying literature supports only general medical relations. The failure motivates immutable source-span grounding and deterministic anchor verification before evidence retrieval and explanation generation. S5 Extended Interpretation, Limitations, and Ethics Functional Interpretation Forecasting target. The benchmark evaluates the code set documented at the next encounter. Disease state, care setting, follow-up, and coding practice all contribute to that target. At K = 20, the output budget may exceed the mean target size and therefore exposes multiple false positives per patient. Forecasting metrics measure recovery of the future documentation set; clinical decision benefit requires additional severity grading, workflow simulation, and prospective evaluation. Candidate-state control. The component audit compares the EHR Prior, Direct Forecast, Research Expansion, and the registered final selectors. Each analysis targets a different stage. Natural-cardinality diagnostics trace candidate coverage against pool growth; the fixed-pool control measures the delivered research-context packet conditional on research-derived candidate identities; and the target-conditioned pool oracle bounds ranking and slot allocation over the observed pool. The support-score retention result supplies a candidate state variable for a future held-out stopping policy. Evidence roles. The retrieval audit characterizes source composition and document usefulness. The explanation audit compares GPT-5 Direct Forecast explanations with ICD-Deepresearch (RRF-selected) explanations whose writer additionally receives canonical code information, candidate clues, and ledger fields. The largest automated GPT-5 judge-score differences occur in exact-code alignment and evidential calibration; next-encounter relevance remains the lowest dimension. Because the two writers receive different input states, this audit characterizes the complete explanation configurations rather than causally isolating any single field. The case traces further separate code definitions from directional clinical relations and motivate the patient-anchor–relation–code verification contract developed in the main paper. Limitations and Ethics The primary ICD-Deepresearch analysis uses its Evidence-Aware Reranker on saved, target-blind proposal states. End-to-end replay additionally requires the complete Candidate Generation implementation, including its SparseEHR checkpoint, as well as proposal functions and live Web results. The reported explanation audit instead uses the archived RRF-selected prediction prefix and must not be interpreted as an explanation audit of the full Evidence-Aware output. MIMIC-I and MIMIC-IV originate from one health-system setting, and EHRSHOT supplies a mixed-vocabulary diagnostic. Patient-boundary compatibility. The reported method is patient-local and excludes both cross-evaluation-patient query selection and cohort-frequency filling. Some legacy schemas and prompt-version identifiers retain frequency-related names, and an archived candidate-construction path populated such a transductive fill. Those legacy artifacts fall outside the information boundary in Section S2 and cannot be substituted for release outputs. Reproduction audits should verify that all frequency-fill fields are empty (or fixed only from disjoint training/development data) before a saved candidate state is attributed to the reported method. The source audit samples 50 retrieved occurrences per system–dataset cell. Its automated proxy receives the query, title, URL, and pre-target record; two physicians independently assign binary document-usefulness labels, and the reported rate is the mean of their two 50-document rates. These percentages are descriptive; no adjudicated consensus or uncertainty interval is claimed. Passage-level relation entailment is evaluated through the saved candidate and case traces. Independent relation coverage remains low, and dictionary citations establish code meaning without establishing next-encounter likelihood. Reason quality uses an automated, gold-aware GPT-5 semantic judge after all prediction and explanation outputs are frozen. The judge is item-blind to method identity, but GPT-5 also generates several compared outputs; it is therefore not independent clinical validation. Dual-clinician explanation annotation and adjudication would strengthen this evaluation. Saved traces reveal unsupported patient anchors, showing that a credible external source does not validate an unresolved patient premise. The available archive contains partial token, latency, cost, prompt, checkpoint, and runtime records; live search results also change over time. Clinical use requires de-identification, controlled source retention, prompt-injection defenses, deterministic anchor and relation verification, severity-aware false positive analysis, and clinician or certified-coder oversight. Table S2. Component paths, registered selectors, and fixed-pool controls at K = 20. Panels A–B use a development-disjoint random MIMIC-I diagnostic cohort (n = 100) and a frozen-order MIMIC-IV diagnostic cohort (n = 100). Panel C uses a separately registered n = 100 fixed-pool cohort per dataset. Every configuration is executed independently five times on the same frozen patients; each entry is the arithmetic mean of the five run-level metric exports and is displayed to two decimals. Within each dataset block, Panels A–B use identical patient IDs and targets across configurations and runs. Within each Panel C run, all arms use identical candidate identities and randomized display order; research-derived candidate identities remain in every arm. Panel A contains isolated path controls and registered joint-selector outputs. Candidate Generation Only evaluates the complete seed-generation module, for which SparseEHR is the structured-EHR backbone. Research Path Only runs Candidate Generation followed by Research Expansion and evaluates the leading 20 entries of the complete research ordering ̄ R i ; it does not use the potentially shorter EOV-thresholded branch R i . Rows ending in Only are not drop-one ablations. ICD- Deepresearch w/o Evidence-Aware Reranker retains the complete candidate state and uses reciprocal-rank fusion for final selection. The full Evidence-Aware Reranker is reported for both diagnostic cohorts. Panel B reports the standalone research comparators. Panel C fixes candidate identities and randomized order while varying selector context or backend; research-derived candidate identities remain in every fixed-pool arm. Target-conditioned oracles are computed within each run’s observed candidate pool and then averaged across runs. Bold marks the best observed deployable five-run mean within each dataset block; the Micro columns use pooled counts within each run and all metrics are percentages. DatasetComponent or controlMicro-P Micro-R Micro-F1 Macro-F1 Panel A: isolated paths and registered joint selectors MIMIC-I ICD-Deepresearch: Candidate Generation Only21.54 30.4525.2324.12 ICD-Deepresearch: Direct Forecast Only21.80 30.9025.5624.80 ICD-Deepresearch: Research Path Only20.71 29.2924.2723.53 ICD-Deepresearch w/o Evidence-Aware Reranker22.81 32.2626.7325.88 ICD-Deepresearch24.97 35.3029.2528.21 Joint-pool oracle (target-conditioned)32.04 45.2937.5335.84 MIMIC-IV ICD-Deepresearch: Candidate Generation Only14.40 20.6916.9816.88 ICD-Deepresearch: Direct Forecast Only26.60 38.2031.3630.60 ICD-Deepresearch: Research Path Only27.90 40.0932.9032.04 ICD-Deepresearch w/o Evidence-Aware Reranker29.55 42.4634.8533.98 ICD-Deepresearch30.05 43.1835.4434.54 Panel B: standalone research comparators MIMIC-I GPT-5 + Web Search (Standalone)22.91 32.4026.8425.94 MIMIC-I Medical Deep Research (Standalone)17.60 26.2921.0820.53 MIMIC-IV GPT-5 + Web Search (Standalone)28.30 40.6633.3732.63 MIMIC-IV Medical Deep Research (Standalone)13.40 19.0615.7415.56 Panel C: fixed-pool selector context and backend controls MIMIC-I ICD-Deepresearch (Fixed Pool; GPT-5)22.30 35.1227.2826.39 ICD-Deepresearch w/o Research Context (Fixed Pool; GPT-5)22.20 34.9627.1626.48 ICD-Deepresearch w/o Research Context (Fixed Pool; GPT-4o)19.30 30.3923.6122.74 ICD-Deepresearch w/o Research Context (Fixed Pool; GPT-4o-mini)17.90 28.1921.9021.64 Fixed-pool oracle (target-conditioned)27.00 42.5233.0331.50 MIMIC-IV ICD-Deepresearch (Fixed Pool; GPT-5)25.20 36.9529.9629.50 ICD-Deepresearch w/o Research Context (Fixed Pool; GPT-5)23.60 34.6028.0627.79 ICD-Deepresearch w/o Research Context (Fixed Pool; GPT-4o)24.40 35.7829.0128.86 ICD-Deepresearch w/o Research Context (Fixed Pool; GPT-4o-mini)20.40 29.9124.2624.12 Fixed-pool oracle (target-conditioned)29.90 43.8435.5534.78 Table S3. MIMIC-IV Research Round 2 retention diagnostics from the common Research Round 1 state. Mean size is the final candidate-set size and TP is the number of matches among 1,392 held-out targets. Rules are evaluated post hoc on finalized outputs. Patient-macro F1 and micro-F1 are reported as proportions on a 0–1 scale. ConfigurationMean size TP Patient-macro F1Micro-F1 Research Round 1 only36.03 6500.254750.26026 Unconditional Research Round 238.19 6780.254650.26022 Support score≥ 5036.64 6710.258690.26543 Beyond code lookup37.38 6610.252500.25770 Readable source37.35 6610.252660.25785 S6 Prompt, Figure, and Case Reproducibility Archive Exact Values for the Explanation Figures Table S5. Displayed values underlying main-paper Figure 3a–c: automated, gold-aware GPT-5 judge scores for pooled true-positive Reason5 means and CA-RQ5 at K = 20. Means are rounded to two decimals; differences and intervals in the main figure are computed from the unrounded item-level values. The ICD-Deepresearch arm is RRF-selected, has the legacy label AF/Union+RRF in the saved implementation records, and is distinct from the full Evidence-Aware output. DatasetSystem Clinical validity Patient grounding Next-visit relevance ICD alignment Evidential calibration TP mean CA-RQ5 MIMIC-I ICD-Deepresearch (RRF-selected)4.864.613.344.954.474.451.33 GPT-5 (Direct Forecasting)4.834.503.304.874.264.351.29 GPT-4o (Direct Forecasting)4.134.132.634.223.633.750.97 GPT-4o-mini (Direct Forecasting)3.613.732.383.653.173.310.77 MIMIC-IV ICD-Deepresearch (RRF-selected)4.974.873.534.994.694.611.57 GPT-5 (Direct Forecasting)4.874.753.524.934.474.511.36 GPT-4o (Direct Forecasting)3.924.002.654.033.583.641.20 GPT-4o-mini (Direct Forecasting)2.632.641.902.632.552.470.75 For ICD-Deepresearch (RRF-selected) minus GPT-5 (Direct Forecasting), the automated CA-RQ5 differences have 95% confi- dence intervals of−0.02 to +0.09 on MIMIC-I and +0.15 to +0.27 on MIMIC-IV. These scores compare complete explanation configurations with different supplied input states and do not isolate the causal contribution of any single evidence field. In- dependent clinical-relation sources cover 58/499 (11.62%) and 8/577 (1.39%) ICD-Deepresearch (RRF-selected) true-positive explanations, respectively. Prompt and Artifact Provenance The table maps each recorded LLM/API call to its forecasting function. Historical Stage 1/Stage 2 source identifiers corre- spond to Iterations 1/2 of Equation 12. Internal FCG/DCG/DR-CG/JCS and legacy AF/FR labels below identify archived interfaces and runners; the reader-facing system names are EHR Prior, Direct Forecast, Research Expansion, Final Selection, and ICD-Deepresearch. In this mapping, FR is the Evidence-Aware selector used by the full ICD-Deepresearch system, whereas AF/Union+RRF is the selector replacement reported as ICD-Deepresearch w/o Evidence-Aware Reranker. The explanation archive is based on the latter RRF-selected output. Table S6. Executable-call inventory mapped to the forecasting functions. “Call” denotes an LLM invocation; deterministic and API rows record the complete execution boundary. Line ranges and archival source descriptions identify the executed call sites. Functional roleExecutable call or component Executable source and prompt linesRole in the reported path Candidate Generation (internal FCG) Complete candidate-generation interface with a SparseEHR backbone for the ICD tasks SparseEHR backbone described in (Ghaffari et al. 2026); registered MIMIC-I/IV and EHRSHOT candidate exports Structured pre-target EHR→ ordered target-vocabulary candidates π F i and set B i used by the Candidate Generation Only control and Research Expansion initialization. Research Expansion (internal DR-CG) Iteration 1 candidate-formulation call (archived Stage 1) archived Stage 1 candidate runner, lines 94–115 Saved EHR Prior candidates and the pre-target record→ patient-anchored hypotheses and validation queries. Research Expansion (internal DR-CG) Iteration 1 add judge (archived Stage 1) Same file, lines 134–138Separately judges patient anchor, literature bridge, and exact mapping for Iteration 1 candidates. Research Expansion (internal DR-CG) Iteration 2 query planner (archived Stage 2) archived Stage 2 expansion runner, lines 292–308 Produces short relation queries; rejected Iteration 1 candidates are force-carried outside this call. Research Expansion (internal DR-CG) Iteration 2 exact-code mapper (archived Stage 2) Same file, lines 311–329Maps query evidence and the pre-target record to new target-vocabulary-valid code hypotheses. Research Expansion (internal DR-CG) Iteration 2 three-part judge (archived Stage 2) Same file, lines 496–503Used once for initial verdicts and again for evidence repair; the call prefix and previous-decision payload change. Research Expansion (internal DR-CG) Verdict-completion judges work/rerun_mimic3_ untruncated_judge.mjs, lines 105–180; work/rerun_mimic4_ untruncated_judge.mjs, lines 89–145 Dataset-specific ICD-9/ICD-10 batch prompts repair omitted verdicts; MIMIC-I has a final fixed-candidate fallback. Research Expansion (internal DR-CG) Support-score reranker work/mimic3_gpt_confidence_ reranker.mjs, lines 392–417; work/mimic4_gpt_confidence_ reranker.mjs, lines 186–205 Dataset-specific ICD-9/ICD-10 prompts score every dictionary-valid research candidate and emit an end-of-vector threshold. Final Selection: Evidence-Aware Reranker Full ICD-Deepresearch selector (archived JCS-FR/FR; originally Stage A v2) archived full-data MIMIC-I/IV FR runners, corresponding selector and validation ranges Scores every saved union candidate in the full-data MIMIC-I and MIMIC-IV ICD-Deepresearch evaluations and returns a complete ranking from the fixed proposal state. Direct Forecast (internal DCG) Direct diagnosis forecaster experiments/direct-icd- explanation- 100/run_direct.mjs, lines 88–102 and 286–302 Pre-target record→ a bounded ranked code list for the Direct Forecast. Source-audit comparator GPT-5 + Web Search (Standalone) forecaster experiments/direct-gpt5- websearch/run_websearch.mjs, lines 156–189 and 359–376 Required OpenAI Web Search forecast with a self-selected, uncapped search count and exhaustive output ranking. External comparator Medical Deep Research (Standalone) Public Medical Deep Research workflow (Clinical-Copilot 2026) and the task-adaptation wrapper used for the reported outputs Standalone multi-agent medical investigation adapted from the pre-target record to an ICD ranking; it receives no ICD-Deepresearch candidate or selector state. Post-selection explanation Direct explanation writer experiments/direct-icd- explanation- 100/run_direct.mjs, lines 105–117 and 269–283 Explains each selected direct code in the K = 20 audit from the pre-target record and parametric knowledge. Post-selection explanation Evidence-linked explanation writer experiments/direct-icd- explanation-100/run_ours_ explanations.mjs, lines 315–337 and 407–415 Explains the finalized ICD-Deepresearch (RRF-selected; archived AF) selection in the K = 20 audit with code-bound references and uncertainty. Final Selection audit Shared-pool selectorarchived MIMIC-I/IV shared-pool runners, selector ranges Selector used in the candidate-controlled K = 20 research-context ablation. Post-selection explanation MIMIC-I shared-pool explainer archived MIMIC-I shared-pool runner, explanation ranges Writes post-selection reasons for the MIMIC-I shared-pool run after prediction rows are finalized. AuditSource-metadata proxy judge (GPT-5) experiments/search-source- utility-eval/run.mjs, lines 186–231 Produces metadata-proxy labels from query, title, URL, and the pre-target record. AuditAutomated gold-aware Reason5 judge (GPT-5) experiments/direct-icd- explanation-100/run_reason_ judge5_itemblind.mjs, lines 181–198 and 263–271 After all outputs are finalized, scores five explanation dimensions for shuffled true-positive reasons using the pre-target record and complete held-out gold set; method identity is hidden, but this is not independent clinical adjudication. Research Expansion tool layer Search, reader, and dictionary controls SearchCans/Google; PubMed or fixed PMC/arXiv workers; local ICD dictionary Search engines and readers return candidate-bound observations; deterministic dictionary processing normalizes and validates target-code identity. Final Selection: Union+RRF Deterministic RRF selector replacement build_union_rrf.mjsCombines the finalized Direct Forecast rank D i and EOV-thresholded research rank R i with k 0 = 60 and returns ICD-Deepresearch w/o Evidence-Aware Reranker; no retrieval or LLM call occurs in this step. Execution boundary. The inventory covers the LLM calls, search and page-reading APIs, local ICD lookup, validation gates, RRF, explanation writers, and audit judges reached by the reported paths. Together, these rows provide the call-level provenance for the EHR Prior, Direct Forecast, Research Expansion, Final Selection, explanation, and audit functions. S7 Prompt Design and Internal Call Contracts Archival conventions. Prompts are reproduced verbatim from the executed configurations. Historical Stage 1/Stage 2 labels correspond to Iterations 1/2 of the current method, K = 20 and “locked” language records the executed evaluation prefixes, and 0–100 outputs are analyzed as model-assigned ranking or support scores. Before evaluation, the GPT-5 (Direct Forecasting) and GPT-5 + Web Search (Standalone) prompts were refined under the same target-blind task boundary; the latter configuration additionally requires tool use and permits a self-selected uncapped search count. The labels AF and FR below are preserved only when they identify executed artifacts: AF/Union+RRF is displayed as ICD-Deepresearch (RRF-selected), and FR/Stage A v2 is the Evidence-Aware Reranker used by the full ICD-Deepresearch model. The suffix Only identifies an isolated path and Standalone identifies an external system. The explanation and Reason5 archive uses the RRF-selected AF output, not the full FR output. The prompt text itself remains verbatim. Tables that display only ICD-10-CM wording are explicitly labeled as MIMIC-IV renderings and must not be read as verbatim MIMIC-I prompts. A MIMIC-I code-system resolution is claimed only where an executable ICD-9-CM template or an explicit resolution rule is recorded below. The Evidence-Aware prompt retains frequency-related categories from its legacy schema; their presence documents the archived interface and does not override the patient-local release contract in Section S2. Table S7. Exact static MIMIC-IV Iteration 1 candidate-formulation prompt used inside Research Expansion (archived Stage 1), segmented for readability; only dynamic payloads and line wrapping are replaced. This call is distinct from the SparseEHR-based Candidate Generation module. The implementation then deterministically merges eligible exact codes observed in history as proposals before applying the candidate limit. Iteration 1 (Archived Stage 1): Patient-Anchored Temporal Candidate Formulation System messageGenerate patient-anchored temporal diagnosis candidates and falsifiable clinical queries. JSON only. Role and target control You are expanding exact ICD-10-CM diagnosis code candidates from PRE-TARGET patient history. The target is every unique ICD-10-CM diagnosis code assigned during the patient’s final admission. Do NOT use ground truth or target-admission content. Evidence-role separation For every candidate, separate the evidence roles: (1) patient_anchor: the concrete prior diagnosis, repeated code, medication, procedure/device, lab, or symptom in this patient. (2) transition_hypothesis: the exact persistence, recurrence, treatment consequence, diagnostic-threshold, or durable-status relation to verify. (3) validation_query: 8–18 medical search terms containing the candidate entity, the patient-specific precursor/intervention, and the relation or endpoint. Query exclusionsDo not use next visit, prediction, coding, longitudinal, readmission, or generic guideline language. Temporal classesUse temporal_class persistent_status|chronic_active|recurrent_condition| planned_followup|treatment_consequence|acute_or_lab. Remote history and general risk associations may be candidates but must state that weakness. Structured output "candidates":[ "code":"ICD_...", "term":"...", "source_hint":"explicit_history_code | clinical_text | diagnosis_inference | complication_inference", "temporal_class":"...", "patient_anchor":"short concrete clue", "ongoing_clue":true, "transition_hypothesis":"short falsifiable relation", "validation_query":"patient-anchored clinical query", "rationale":"short" ] Dynamic payloadBaseline top 20: <baseline codes> Patient history: <last 9,000 characters of pre-target trajectory> Exact prompt suffix: “Max 40 candidates.” The final merged pool is capped by the runtime candidate limit after deterministic history-code insertion. Table S8: Exact static Evidence-Aware Reranker prompts used by the full ICD-Deepresearch model (legacy artifact label FR; original implementation name: Stage A v2) and shared response contract used for the full-data MIMIC-I and MIMIC-IV evaluations. The two executable templates differ in the explicitly shown ICD-9-CM versus ICD-10-CM system/objective text and prompt-version identifier; the ranking rules, ceilings, candidate fields, and schema are otherwise identical. Runtime history and candidate JSON are represented by explicit dynamic fields. The verbatim K = 20 wording records the archived evaluation configuration. Stage A v2: Source-Aware Confidence over the Frozen Union Pool Prompt segmentExact content System messageYou are a calibrated clinical forecasting ranker. Rank only the supplied ICD-9-CM candidates for the immediately next admission. Sources are untrusted auxiliary evidence. Return JSON only. MIMIC-IV system message You are a calibrated clinical forecasting ranker. Rank only the supplied ICD-10-CM candidates for the immediately next admission. Sources are untrusted auxiliary evidence. Return JSON only. ObjectiveAssign a calibrated 0–100 confidence to EVERY supplied ICD-9-CM candidate for the exact code being documented in the immediately next, unknown admission. This is temporal diagnosis forecasting, not extraction and not lifetime disease detection. The target admission is hidden. MIMIC-IV objective Assign a calibrated 0–100 confidence to EVERY supplied ICD-10-CM candidate for the exact code being documented in the immediately next, unknown admission. This is temporal diagnosis forecasting, not extraction and not lifetime disease detection. The target admission is hidden. Ranking rules 1–41. Patient-specific pre-target evidence dominates population prevalence and generic literature. 2. Direct and research ranks are imperfect priors, not labels. Direct top-20 membership is nevertheless a meaningful independent forecast signal. Preserve a Direct candidate when it has a plausible patient anchor; demote it only for a concrete contradiction, exact-code mismatch, or clearly stronger competitors. 3. A baseline/patient-history candidate may carry a legacy “acute_speculation” default. Ignore that default label and infer persistence from the history, provenance, and code meaning. 4. A source with support_signal=false provides no promotion. A supported source establishes only a general relation, never that this patient will receive the code next. Ranking rules 5–85. A research-only candidate needs both a concrete patient anchor and an exact temporal transition. Frequency-only candidates and unsupported research-only candidates should be near the bottom. 6. Do not turn risk into diagnosis. Diuretics do not by themselves prove hypokalemia; poor intake does not prove dehydration; CAD does not prove diabetes; sepsis does not prove a CKD stage. 7. Validate exact specificity. Family-level evidence cannot establish a subtype, stage, complication status, or sibling code. Prefer the exact historically supported code and avoid ranking multiple incompatible family variants highly. 8. Durable statuses, repeated active chronic diseases, explicit follow-up plans, and repeatedly coded conditions are stronger than isolated remote events. Ranking rules 9–12 9. Acute-preservation rule: absence of a web source is neutral for an acute diagnosis. A Direct acute candidate with exact prior occurrence, current patient-specific physiology, a relevant procedure, or a documented recurrent pathway should remain competitive. Do not suppress AKI, heart failure, respiratory failure, infection, or an acute metabolic disorder merely because chronic codes are easier to justify. This is not permission to infer an acute diagnosis from generic risk alone. 10. Generic symptoms, common lab abnormalities, and unspecified diagnoses must compete for a scarce slot. Give them low scores when they merely restate nonspecific risk or when a better-supported exact sibling is present. 11. Use a consistent probability-like scale across patients. Do not assign mechanically decreasing scores merely to create an ordering. 12. Score all candidates independently, then calibrate jointly. Return every candidate_id exactly once. Do not add codes. Suggested confidence ceilings Frequency-only with no patient anchor: at most 10. Unsupported research-only with no patient anchor: at most 15. Generic family evidence without exact-code support: at most 25. A speculative lab abnormality or treatment complication without prior occurrence: at most 25. A source-supported but patient-unanchored candidate: at most 25. Continued on the next page. Supplementary Table S8 continued from the previous page. Prompt segmentExact content Dynamic payloadPRE-TARGET PATIENT HISTORY: <row.pre_text> CANDIDATES IN RANDOMIZED ORDER: one JSON object per candidate with every executable field: candidate_id, code, title, provenance, baseline, history_occurrences, direct_rank, direct_confidence_raw, research_rank, research_confidence_raw, temporal_class, metadata_warning, patient_clue, transition_hypothesis, source_status, sources. Strict response contract Return row_idx and a scores array whose length equals the supplied pool. Every item must contain one unique supplied candidate_id, confidence in [0, 100], patient_anchor in strong, moderate, weak, none, exact_code_support in exact, family_only, none, and reason_tag in explicit_current_or_repeated_history, durable_status_or_active_chronic, patient_specific_transition, direct_rank_prior, generic_family_evidence_only, frequency_prior_only, speculative_complication, unsupported_or_irrelevant_source, exact_code_mismatch, weak_or_no_patient_anchor. Additional properties are rejected. Deterministic lockThe response is sorted by descending confidence, then direct rank, research rank, and normalized code. The first 20 codes are locked. The run introduces no new candidate and consults held-out labels only after every output is saved. Table S9. Exact static MIMIC-IV Iteration 1 add-judge prompt used inside Research Expansion. This is a separate LLM call from the Iteration 1 candidate-formulation call. Stage 1B: Patient Anchor–Literature Bridge–Exact Mapping Judge System messageApply a conservative patient-anchor, literature-bridge, and exact-mapping contract. JSON only. Opening instruction Final-admission ICD-10-CM diagnosis code add editor using a three-part evidence contract. Start from baseline top20 and only assess GPT_EXPANDED_CANDIDATES. Do not use ground truth or target-admission content. Role 1: patient anchor PATIENT ANCHOR comes only from this EHR. It must establish an active/repeated condition, current treatment, durable procedure/device/status, explicit plan, or a concrete acute/lab precursor. Role 2: literature bridge LITERATURE BRIDGE comes from candidate-bound E evidence. It verifies the exact persistence, recurrence, treatment consequence, diagnostic threshold, or durable-status relation. General association and code-title pages are insufficient. Role 3: exact mapping EXACT MAPPING requires the anchor to match the candidate entity, subtype, site, cause, acuity, and status. Clinical policyDurable status may remain true after a documented procedure/device unless removal/reversal is present. Chronic disease needs repeated code or an active treatment/problem clue. Acute events, lab abnormalities, infections, injuries, and precise complication subtypes require direct patient evidence; risk alone never suffices. Literature cannot create a patient diagnosis. Exact output contract "add":[ "code":"ICD_...", "accept":true, "confidence":0.0, "support_type":"persistent_status | chronic_active | recurrent_pattern | planned_followup | treatment_consequence | acute_active | historical_only | risk_only", "patient_anchor_present":true, "patient_anchor_type":"repeated_code | active_treatment | explicit_diagnosis | procedure_device | planned_care | direct_lab_event | remote_history | none", "literature_bridge_supported":true, "exact_mapping_supported":true, "evidence_ids":["E1"], "rationale":"brief role-separated explanation" ] Dynamic payloadBaseline top 20; the last 8,500 characters of patient history; up to 16,000 characters of generated candidates; and up to 26,000 trailing characters of candidate-bound evidence. Table S10. Exact static MIMIC-IV Iteration 2 query-planning prompt (archived Stage 2), segmented for readability. The short-query examples are prompt patterns, not case-specific rules. Stage 2A: Clinical Relation Query Planner System messageGenerate compact clinical-code discovery queries. JSON only. ObjectivePlan second-pass medical discovery queries for ICD-10-CM diagnosis code. No ground truth, target/post codes, or hidden pretrain tail. Stage 1 has already run with the legacy query method. Stage 2 must use a different retrieval strategy. Search designFormulate phrases that resemble real clinical review questions about natural history, disease progression/outcomes, post-procedure persistence or recurrence, reoperation/retreatment rates, or complication incidence/timing/manifestations. Each query tests one patient-anchored clinical hypothesis. Use 4–9 medical terms with one candidate entity, at most one concrete precursor/intervention, and one endpoint. Generate 2–3 separate phrases for distinct search angles; never concatenate multiple conditions, procedures, endpoints, or raw note tokens. Force-carry and exclusions Never use next visit, prediction, coding, code definition, guideline, longitudinal, or readmission as filler. Every rejected stage-1 candidate listed below will be force-carried and searched separately; use this plan to discover additional candidates and clinical relations. Allow no query for unsupported classes. Prompt examples post-stroke depression long-term persistence autologous stem cell transplant engraftment complications prosthetic heart valve long-term follow-up cancer anemia chronic disease iron studies cervical disc herniation natural history native coronary atherosclerosis after CABG TURP long-term LUTS recurrence These work because they search relations that clinical literature actually studies: natural history, progression, persistence, recurrence or reoperation, and complication incidence or timing. Each phrase contains one clinical entity, at most one relevant intervention, and one endpoint. Split distinct intents into separate queries. Structured output "queries":[ "query":"4-9 term phrase", "query_variants":["alternative 4-9 term phrase"], "focus":"candidate entity", "patient_anchor":"concrete EHR clue", "clinical_relation":"short falsifiable relation", "evidence_needed":"specific endpoint, threshold, persistence, or consequence", "source_type":"procedure_status | chronic_persistence | recurrence | treatment_consequence | diagnostic_threshold | planned_care" ] Dynamic payloadBaseline top 20; accepted Stage 1 additions; rejected Stage 1 candidates; prior candidate summaries; prior source titles; and the last 6,500 characters of patient history. Maximum eight hypotheses. Table S11. Exact static MIMIC-IV Iteration 2 candidate-mapping prompt (archived Stage 2). This agent sees the query plan and retrieved text, but every proposed code must still bind to the patient’s pre-target record. Stage 2B: Evidence-Conditioned Exact-Code Mapper System messageMap compact clinical entities to exact ICD candidates. JSON only. TaskSecond-pass ICD-10-CM diagnosis code candidate mapper. Do NOT use ground truth, target/post codes, or hidden pretrain top21–100. Use patient history plus second-pass search snippets to propose exact normalized code candidates NOT already in CURRENT_CODES. Valid formats include ICD_.... You may reuse first-pass generated candidates that were not accepted. Per-candidate fields For every candidate provide: (1) a concrete patient_anchor from this EHR, (2) temporal_class, (3) a short falsifiable transition_hypothesis, and (4) 2–3 validation_queries. Every query must be a 4–9 term phrase containing one candidate entity, at most one precursor/intervention, and one endpoint. Split distinct intents; do not concatenate note tokens. Never use next visit, prediction, coding, guideline, longitudinal, or readmission as filler. Generate direct entity mappings before supported complications/status expansions. Avoid pure risk-factor speculation and broad catch-all codes. Shared example block The prompt inserts the exact SHORT_QUERY_EXAMPLES block reproduced in Table S10, from “Short-query examples (patterns, not patient-specific rules):” through “Split distinct intents into separate queries.” Mapping types direct_entity | specific_variant | complication | status | history | procedure_consequence | medication_effect | recurring_lab_procedure | risk_association. Structured output "candidates":[ "code":"ICD_...", "term":"...", "mapping_type":"...", "temporal_class":"...", "entity":"short clinical entity", "patient_anchor":"concrete EHR clue", "ongoing_clue":true, "transition_hypothesis":"short medical relation", "validation_queries":["4-9 term phrase", "alternative phrase"], "source_hint":"query_term | query_evidence | patient_history | procedure_context | first_pass_candidate", "rationale":"short" ] Dynamic payloadExcluded current codes; second-pass query plan; up to 24,000 characters of readable query evidence; and up to 8,000 characters of patient history. Maximum 60 candidates after normalization and dictionary validation. Table S12. Exact static default MIMIC-IV Iteration 2 judge prompt (archived Stage 2). The same function is called for the initial pass and the targeted repair pass; only the opening prefix and previous-decision payload differ. Stage 2C: Default Three-Part Add Judge System messageJudge patient anchor, literature bridge, and exact clinical-code mapping separately. JSON only. Opening instruction “Second-stage” (initial call) or “Evidence-repair” (repair call) clinical-code add editor using a three-part evidence contract. Assess only the supplied candidates. Do not use ground truth, target/post codes, or hidden pretrain tail. Patient anchorPATIENT ANCHOR comes only from this EHR: repeated code, active diagnosis/treatment, durable procedure/device/status, explicit plan, or direct acute/lab event. Literature bridgeLITERATURE BRIDGE comes from candidate-bound E or QEV sources and verifies the claimed medical persistence, recurrence, treatment consequence, diagnostic threshold, or durable-status relation. It does not need to prove that this individual patient will be coded next. Exact mappingEXACT MAPPING requires the patient anchor to match the candidate entity, subtype, site, cause, acuity, and status. Clinical policyDurable procedure/device status can persist unless removal is documented. Chronic disease needs repetition or an active treatment/problem clue. Acute events, infections, injuries, laboratory abnormalities, and precise complications require a direct patient event, threshold, or explicit plan; general risk is insufficient. Literature cannot create a patient diagnosis. Exact output contract One record per assessed candidate with fields code, accept, confidence, support_type, patient_anchor_present, patient_anchor_type, literature_bridge_supported, exact_mapping_supported, evidence_ids, query_evidence_ids, and a brief role-separated rationale. Dynamic payloadCurrent codes; Stage 1 accepted additions; previous decision when present; the last 8,000 history characters; up to 15,000 characters of candidates; up to 26,000 characters of candidate-bound readable evidence; and up to 16,000 characters of readable discovery evidence. The assembled prompt is capped at 30,000 characters. Runtime gatePost-processing retains only accept=true records for which all three booleans are true, confidence is at least the configured threshold (0.68 in the frozen logic), support is not historical/risk-only, and evidence IDs resolve to the candidate or matched query. Table S13. Exact static MIMIC-IV verdict-completion prompt used when a long Stage 2 response (Iteration 2 in the method) omitted candidate verdicts. It is a repair/completion call, not the default Stage 2 policy. Stage 2D: Untruncated Verdict-Completion Judge System messageJudge every supplied clinical-code candidate. Return one verdict per code. JSON only. Core instructionYou are the legacy second-stage clinical-code add judge. Assess every supplied candidate independently. Do not omit a candidate and do not rank candidates against one another. Patient history is primary evidence. Literature may verify code meaning, persistence, recurrence, treatment consequence, or a bridge from the patient context to the candidate, but literature cannot create a patient diagnosis. Acceptance ruleAdd chronic or persistent conditions only with an explicit prior diagnosis, repeated code, active treatment, durable status/procedure, or other concrete ongoing clue. Add acute events, laboratory abnormalities, injuries, infections, external causes, or precise complications only with a direct current event, lab/treatment context, or strong recurrent pattern. A prior code is a clue but may support a persistent chronic condition when the candidate and patient history match exactly. Reject a related but different subtype. DNR alone does not establish a palliative-care encounter. Structured output "add":[ "code":"ICD_...", "direct_support":true, "support_type":"persistent_current|procedure_supported| active_context|prior_only|speculative", "evidence_ids":["E1"], "query_evidence_ids":["QEV_E1"], "rationale":"brief" ] Interface limitation Unlike Table S12, this exact archived response does not contain accept, confidence, literature_bridge_supported, or exact_mapping_supported. No unreported field mapping is assumed; a uniform-gate release must rejudge these fixed proposals with the default three-part contract. Dynamic payloadCurrent codes; up to 8,000 characters of patient history; and every candidate paired with its dictionary title, candidate-bound evidence, and semantically matched discovery evidence. Missing verdicts are retried per ICD until every candidate has one output record. Observed enforcement gap The natural-language policy is stricter than the saved decisions: row 59 accepted several candidates whose stated anchors are absent from the supplied structured trajectory. This motivates immutable anchor spans rather than free-text anchor claims. Table S14. Exact static MIMIC-I verdict-completion prompts. The batch call retries omitted codes; any code still missing after those retries receives the fixed-candidate fallback call. MIMIC-I ICD-9 Verdict Completion and Fixed-Candidate Fallback Batch system message Judge patient anchor, literature bridge, and exact ICD-9 mapping separately. JSON only. Batch openingYou are a strict future-admission ICD-9 prediction judge using a three-part evidence contract. Everything in PATIENT HISTORY happened before the unknown target admission. Judge each role independently. Three exact roles1. PATIENT ANCHOR comes only from this EHR. It must be a repeated code, active diagnosis/treatment, durable procedure/device/status, explicit plan, or direct acute/lab precursor. 2. LITERATURE BRIDGE comes from candidate-bound Reader evidence. It verifies the claimed general medical persistence, recurrence, treatment consequence, diagnostic threshold, or durable-status relation. It does not need to prove that this individual patient will be coded next. 3. EXACT MAPPING requires the patient anchor to match the candidate entity, subtype, site, cause, acuity, and status. Batch policyDurable procedure/device status can persist unless removal is documented. Chronic disease can be supported by either repetition or a concrete active treatment/problem clue. Acute symptoms, infection, injury, lab abnormalities, and precise complications require direct patient evidence; general risk is insufficient. Literature cannot create a patient diagnosis. Return one record for every assessed candidate. JSON only. Batch contract add[code, accept, confidence, support_type, patient_anchor_present, patient_anchor_type, literature_bridge_supported, exact_mapping_supported, evidence_ids, rationale]; dynamic sections are CURRENT CODES, CANDIDATES, the last 8,500 history characters, and CANDIDATE-BOUND READER EVIDENCE. Fallback system message Return one explicit accept or reject verdict for the fixed ICD-9 candidate. JSON only. Fallback user instruction Judge whether this ICD-9 candidate should be added to the prediction for the patient’s final target admission. Use only the pre-target patient history as the clinical anchor. The attached literature may validate meaning, persistence, recurrence, treatment consequence, or a medical bridge, but cannot invent a patient diagnosis. Chronic and durable conditions need an explicit prior diagnosis, active treatment, repeated code, durable procedure/status, or another concrete ongoing clue. Acute or precise conditions need a direct event or strong recurrent pattern. Reject association-only, risk-only, mismatched-subtype, and unsupported candidates. Fallback contractYou must return a verdict even when the candidate is invalid or unsupported. Do not return the ICD code. JSON only: "accept":false, "confidence":0.0, "support_type":"unsupported", "patient_anchor_present":false, "literature_bridge_supported":false, "exact_mapping_supported":false, "evidence_ids":[], "rationale":"brief medical rationale" Table S15. Exact static MIMIC-IV and MIMIC-I research-confidence prompts plus the deterministic Union+RRF selector replacement reported as ICD-Deepresearch w/o Evidence-Aware Reranker. Each confidence agent scores every dictionary-valid candidate; RRF combines the resulting research rank with the independent Direct GPT-5 rank. Research Confidence Ranking and Candidate-Union Fusion System messageYou are a calibrated next-visit ICD-10-CM diagnosis ranking model. Score candidates independently, then calibrate the ranking jointly. JSON only. MIMIC-IV instruction Rank every supplied ICD-10-CM candidate for the patient’s unknown final visit. The history below is the only patient-specific information available before the target visit. Predict which exact diagnoses are likely to be coded at that next visit. A past code can recur, persist, resolve, or be irrelevant. General retrieved evidence may support a medical transition but does not prove that it will occur in this patient. Use one calibrated 0–100 probability scale across all candidates. Reward active chronic disease, durable status, repeated diagnoses, plausible complications, and coherent care transitions. Penalize resolved events, unsupported specificity, distant associations, and diagnoses supported only by a generic code-description page. MIMIC-IV output "eov_threshold":50, "scores":["code":"ICD_...", "confidence":0] Return one patient-specific eov_threshold (0–100). The complete variable-length prediction contains candidates with confidence≥ eov_threshold. Return JSON only, include every supplied code exactly once, and introduce no new code. MIMIC-I systemYou are a calibrated next-admission ICD-9 ranking model. Evaluate candidates independently, then calibrate them jointly. JSON only. MIMIC-I instruction Score every candidate ICD-9-CM diagnosis for the unknown final admission. The PATIENT HISTORY contains only information available before the target admission. Do not infer that a historical diagnosis must recur. Estimate the probability that the exact candidate code, at its stated specificity, will be assigned during the next admission. Distinguish persistent active disease, durable status, recurrent disease, likely complications, isolated past events, and speculative associations. Retrieved sources support general medical transitions but do not prove this patient’s future diagnosis. Use one consistent 0–100 scale across all candidates: 90–100 near-certain; 70–89 likely; 45–69 plausible but uncertain; 20–44 weak; 0–19 unlikely. MIMIC-I outputAlso return one patient-specific eov_threshold from 0–100. A candidate with confidence≥ eov_threshold is in the variable-length diagnosis prediction set before EOV. The threshold should balance missing likely diagnoses against unsupported additions. Return JSON only. Include every supplied code exactly once and do not introduce new codes: "eov_threshold":0, "scores":["code":"ICD_...", "confidence":0, "include_before_eov":false] RRF selector replacement For candidate c, s(c) = ⊮[c∈ D]/(60 + r D (c)) +⊮[c∈ R]/(60 + r R (c)). Codes are dictionary validated and the union is sorted by s(c); evaluation uses the leading K entries. No LLM call occurs in this step. Interpretive boundary RRF rewards cross-branch agreement and can promote complementary mid-ranked codes, but its score is not a probability and does not establish that retrieval caused either branch’s ranking. Table S16. Exact static Direct GPT forecasting prompt used for Direct Forecast Only and as the independent direct branch of the RRF selector replacement. The model name changes by arm; no retrieval tool, candidate pool, baseline prediction, dictionary content, or other system output is supplied. Independent Direct Forecast Prompt System messageIndependently forecast ICD-10-CM diagnoses from the supplied pre-target patient history. Return JSON only. Opening and restriction Forecast the ICD-10-CM diagnosis codes most likely to be assigned during this patient’s unknown next/final admission. Use ONLY the observed pre-target patient history below and your own medical/coding knowledge. No future encounter information is available. You have no candidate list, baseline predictions, retrieved sources, external tools, or outputs from another system. Prediction requirements Independently generate 20 to 30 unique ICD-10-CM diagnosis codes. Do not output ICD-9-CM, CPT, procedure codes, or prose in the code field. Rank them from most to least likely for the next/final admission. Give each code a confidence from 0 to 100. Confidence must be non-increasing down the list and should reflect uncertainty rather than forcing every item to look likely. Forecast future coding rather than copying every historical code. Balance persistent diseases/statuses, recurrent conditions, likely acute complications, and procedure/treatment consequences. Preserve exact ICD-10-CM specificity. Do not invent patient facts or assume access to the held-out admission. Structured output "ranked":[ "code":"ICD-10-CM code", "confidence":0 ] Dynamic payloadObserved pre-target patient history: <row.pre_text>. On validation failure the exact suffix is: “Prior structural errors: <feedback>. Regenerate the complete ranking without any external candidate list.” MIMIC-I resolution The same executable template resolves codeSystem to “ICD-9-CM” and otherCodeSystem to “ICD-10-CM”; all other static sentences and the structural retry suffix are unchanged. Table S17. Exact static GPT-5 + Web Search (Standalone) baseline prompt. Unlike ICD-Deepresearch, this agent chooses its own search count and directly produces an unbounded code ranking from OpenAI Web Search results. GPT-5 + Web Search (Standalone) System messageIndependently produce an exhaustive, unbounded ICD-10-CM forecast from pre-target history. Use Web Search for general medical and coding evidence, maximize recall, and return JSON only. Opening and restriction Forecast every distinct ICD-10-CM diagnosis code that could plausibly be assigned during the unknown target encounter represented by the final empty icd_list_begin marker. Use ONLY the observed pre-target patient history below, your medical and coding knowledge, and the provided Web Search tool. No future encounter information is available. You have no baseline predictions, candidate list, dictionary entries, or outputs from another system. Search policyYou MUST use Web Search before finalizing the ranking: Decide the number of searches yourself from the complexity and uncertainty of this patient’s trajectory; there is no minimum or maximum search-count target beyond using the tool at least once. Search each clinically distinct unresolved trajectory when doing so could change candidate inclusion, code specificity, confidence, or rank. Continue searching while another focused query is likely to add decision-relevant evidence; stop when additional searches would only repeat information already found. Search for diagnosis progression, common next-encounter diagnoses, treatment/complication relations, and exact ICD-10-CM terminology when useful. Do not include patient identifiers or long excerpts from the patient history in a query. Use retrieved pages as general medical or coding evidence, not as hidden patient facts. Unbounded objective The objective is exhaustive recall. There is deliberately NO prediction-count budget: Do not target or stop at 20, 30, or any other preset number. Generate as many distinct, medically defensible codes as the trajectory can support, including lower-confidence possibilities. Continue until further codes would be unrelated to this patient or would merely duplicate a more appropriate code already listed. Ranking/output1. Rank all generated codes from most to least likely for the unknown target encounter. 2. Assign confidence from 0 to 100 in non-increasing order. Low-confidence candidates are allowed and should remain low. 3. Cover the full trajectory, including persistent and recurrent diagnoses, durable status/history codes, treatment consequences, plausible acute developments, comorbidities, and follow-up-related diagnoses. 4. Preserve exact ICD-10-CM specificity when justified. Do not invent hidden patient facts. 5. Do not output ICD-9-CM, CPT, ICD-10-PCS procedure codes, or prose in the code field. 6. Return JSON only: "ranked":["code":"ICD-10-CM code","confidence":0]. Tool and retryOpenAI Responses API tool: web_search_preview, tool_choice="required", search_context_size="low". The exact retry suffix is: “Prior structural errors: <feedback>. Regenerate the complete exhaustive list without imposing a count limit.” The MIMIC-I resolution substitutes the ICD-9-CM target sentence and its exact opposite-vocabulary exclusion. Table S18. Exact static Direct-model explanation prompt, distinct from the evidence-linked explanation writer. Direct Locked-Prediction Explanation Writer System messageExplain locked next-admission ICD-10-CM predictions using only the supplied patient history. Return JSON only. User instructionExplain the following locked ICD-10-CM predictions for the patient’s unknown next/final admission. Use ONLY the observed pre-target patient history and your own medical/coding knowledge. The prediction set is already locked: do not add, remove, replace, or reorder codes. No gold answer, candidate pool, baseline prediction, retrieval result, external source, or other system output is available. Medical outputFor every code, write one concise English medical rationale linking observed history to possible next-admission coding, plus one concise uncertainty statement. Do not claim that the future diagnosis is known. Do not mention models, prompts, experiments, candidates, or evaluation. Exact JSON "explanations":[ "code":"locked code", "rationale":"medical rationale", "uncertainty":"specific limitation" ] Dynamic payload/retry Ten locked predictions per parallel explanation chunk and the full observed pre-target history. Validation requires one explanation per locked code. The exact retry suffix is: “Prior structural errors: <feedback>. Return corrected complete JSON.” MIMIC-I resolution The same executable template replaces “ICD-10-CM” with “ICD-9-CM” in the system, opening, and output-schema context; the remaining static prose is unchanged. Table S19. Exact static evidence-linked explanation prompt for ICD-Deepresearch (RRF-selected; legacy artifact label AF), segmented for readability. Predictions and order are finalized before this call, so the explanation agent cannot improve prediction metrics; this prompt was not evaluated on the full ICD-Deepresearch outputs produced by the Evidence-Aware Reranker (legacy label FR). Verbatim “locked” language below reflects the archived K = 20 implementation. Locked-Prediction Explanation Agent System messageWrite evidence-linked medical explanations for locked next-admission ICD-10-CM forecasts. Return JSON only. Prediction lockWrite concise English medical explanations for the 20 locked ICD-10-CM forecasts for this patient’s unknown next/final admission. The prediction set and ranking are fixed. Do not add, remove, replace, or reorder codes. Use only the observed pre-target history, the candidate-specific clues, and the supplied evidence ledger. The held-out admission and gold codes are not available. Medical requirements 1. Explain medicine only. Never mention a model, system, baseline, candidate-generation stage, rank, prompt, experiment, or evaluation. 2. For every exact code, state a patient-specific medical bridge from observed history to possible next-admission documentation. Similar diagnoses may share concise reasoning, but each code must receive its own explanation. 3. Preserve exact disease, organ, acuity, status, device, complication, and laterality. Do not substitute a nearby diagnosis. 4. Chronic/status/history codes may persist when their anchor remains relevant. Acute diagnoses, symptoms, injuries, and abnormalities require recurrence or renewed documentation; do not portray them as certain. 7. Give one medically specific uncertainty statement. Do not invent future symptoms, tests, procedures, treatments, or diagnoses. 8. Return every locked code exactly once as JSON. Citation contract5. Use a definition reference only to establish code meaning. Use a relation source only for a claim actually supported by its excerpt. General literature cannot prove this patient’s future event. 6. Cite only reference IDs assigned to that same code. Put bracketed citations such as [1][2] next to the supported claim and return those same integers in citation_ids. Every explanation must cite at least its definition reference. Structured output "explanations":[ "code":"locked code", "rationale":"medical rationale with [id]", "uncertainty":"specific limitation", "citation_ids":[1] ] Dynamic payloadObserved history; locked predictions with code-specific clues and allowed reference IDs; and numbered evidence ledger. Structural validation requires all 20 codes exactly once and rejects cross-code or missing citations. The exact retry suffix is: “Prior structural errors: <feedback>. Return a corrected complete response.” MIMIC-I resolution The same executable template replaces “ICD-10-CM” with “ICD-9-CM” in its two code-system slots; all numbered requirements, payload labels, and retry text are unchanged. Table S20. Exact static candidate-controlled shared-pool selector prompts. MIMIC-IV and MIMIC-I use separate executable templates, reproduced here rather than described as a simple vocabulary substitution. Evaluation-Only Shared-Pool Selector System messageYou rank a fixed candidate pool for prospective ICD-10-CM forecasting. Return JSON only. OpeningPredict exactly 20 unique ICD-10-CM diagnoses for the patient’s unknown next encounter. This is prospective next-encounter forecasting, not coding a future note. The held-out target is unavailable. Select only from the supplied valid candidate pool. Candidate order is deterministically randomized and carries no rank signal. RequirementsReturn exactly 20 different candidate_id values, ordered from highest to lowest confidence. Copy IDs exactly; do not add, duplicate, substitute, or omit a slot. Rank persistent active disease, recurrent conditions, near-term treatment consequences, and strongly anchored follow-up needs above generic medical possibilities. Preserve exact ICD entity, acuity, anatomy, status, device, laterality, and complication. Do not invent patient facts or assume access to the held-out encounter. Controlled contrast Ledger arm: “Use the supplied target-blind research ledger critically. A definition or general relation does not by itself prove next-encounter occurrence.” No-ledger arms: “Use only the observed trajectory and candidate code identities; no research ledger is available.” MIMIC-IV output/payload Return "ranked":["candidate_id":"C01","confidence":0]. The dynamic payload contains the pre-target trajectory and the same randomized pool; only the ledger arm receives candidate-specific research fields. The exact retry suffix is: “Prior response errors: <feedback>. Return corrected JSON.” MIMIC-I systemYou produce an exact-cardinality next-admission ICD-9 ranking. Return JSON only. MIMIC-I opening Predict exactly 20 unique ICD-9-CM diagnoses for the patient’s unknown next/final admission. This is next-encounter forecasting, not extraction from a future note. The gold answer is unavailable. Select only from the supplied valid candidate pool. The list order is randomized and contains no rank signal. MIMIC-I requirements 1. Return exactly 20 different candidate_id values, ordered best to worst. Copy IDs exactly from the pool. Never add, duplicate, substitute, or omit a slot. 2. For each selected candidate_id, provide confidence 0–100. Confidence and list order must agree. 3. Distinguish persistent active disease/status, recurrent conditions, likely complications, isolated historical events, and unsupported possibilities. 4. Preserve the exact ICD entity, acuity, anatomy, status, device, laterality, and complication. Do not invent patient facts. 5. Do not mention models, systems, prompts, candidates, stages, experiments, or evaluation. MIMIC-I contrast/output Ledger arm: “6. Use the supplied patient clues and sources critically. Definitions establish identity, not future occurrence; general literature does not prove this patient will receive the code.” No-ledger arms: “6. Use only the observed trajectory and code identities; no retrieved sources are available.” Requirement 7 returns the same exact ranked[candidate_id,confidence] JSON. The exact retry suffix is: “Prior ranking errors: <feedback>. Return corrected complete JSON.” Table S21. Exact static MIMIC-I shared-pool explanation prompt. These post-selection reasons were generated by the K = 20 shared-pool runner but do not enter the candidate-controlled prediction metrics. Verbatim prompt text is preserved below. MIMIC-I Shared-Pool Locked-Prediction Explainer System messageYou explain locked next-admission ICD-9 predictions with concise medical reasoning. Return JSON only. OpeningWrite an English medical next-encounter explanation for each of the <chunk size> locked ICD-9-CM predictions below. The predictions and gold answer are unavailable for revision: do not add, remove, substitute, or reorder codes. Explain the forecast from only the observed pre-target record and supplied method-specific information. Requirements 1–51. Return all <chunk size> locked codes exactly once. 2. For each, write one concise patient-specific medical rationale and one concise uncertainty statement. 3. Preserve exact ICD identity and avoid invented patient or future-visit facts. 4. For weak predictions, say specifically why evidence is insufficient instead of making the code sound certain. 5. Do not mention models, systems, prompts, candidates, stages, ranks, experiments, or evaluation. Method-specific rule Ledger arm: “6. citation_ids may contain only supplied reference IDs assigned to that exact code. Include at least its definition reference. General literature does not establish patient-specific future occurrence.” No-ledger arms: “6. citation_ids must be empty. Do not invent citations, references, or URLs.” Output/payload7. Return JSON only: "explanations":["code":"ICD_...","rationale":"one concise medical sentence","uncertainty":"one concise caveat","citation_ids":[]]. Payload headings are OBSERVED PRE-TARGET PATIENT CONTEXT, LOCKED TOP-20 PREDICTIONS, METHOD-SPECIFIC INFORMATION FOR THOSE CODES, and, for the ledger arm, SUPPLIED REFERENCES. Chunk retryTwo ten-code chunks run in parallel. The exact retry suffix is: “Prior chunk <chunk index> errors: <feedback>. Return corrected complete JSON.” Table S22. Exact static source-metadata proxy judge prompt. The archived response schema uses utility-related field names, but this audit sees only source metadata and patient history, not page bodies, system identity, predictions, or gold labels; its outputs are not source-utility measurements. Label-Blind Retrieval-Item Utility Judge System messageYou are a blinded clinical retrieval evaluator. Return JSON only. Task/blindingEvaluate one retrieved webpage for a next-visit diagnosis prediction system. TASK: Given only the patient’s pre-target history, predict diagnosis codes documented at the immediately next hospital visit. BLINDING: You are not told which retrieval system selected this page. Do not infer quality from the query style. Gold diagnoses and model predictions are intentionally absent. Exact definitions credible: URL/domain and title indicate a medically or officially credible source. patient_relevant: the page addresses a diagnosis, mechanism, complication, or follow-up issue grounded in this patient’s history. forecast_useful: it supplies a concrete clinical bridge that could help rank a diagnosis for the immediate next visit. A generic ICD definition alone is NOT forecast-useful. coding_only: useful only for code identity/specificity, without improving which diagnosis is likely next. direct: concrete patient-grounded next-visit bridge; indirect: relevant background or coding help but weak temporal discrimination; none: irrelevant/noisy/unhelpful. Dynamic payloadPatient history (first 5,000 characters), retrieval query (first 600), page title (first 300), and page URL. The exact final instruction is: “Return a strict, conservative judgment. The reason must be one short sentence.” JSON fields credible, patient_relevant, forecast_useful, and coding_only booleans; utility_level in direct|indirect|none; and one-sentence reason. Table S23. Exact static prompt for the automated, gold-aware GPT-5 Reason5 semantic audit, segmented for readability. All prediction and explanation outputs are frozen before the complete gold answer is supplied to this evaluation-only judge. Items hide method identity, but the audit is not independent clinical adjudication. Gold-Aware Item-Blind Five-Dimension Explanation Judge System messageYou are a strict blinded clinical forecast-reason adjudicator. Return JSON only. OpeningYou are a blinded clinical adjudicator evaluating individually anonymized reasons for exact Top-20 next-admission ICD-10-CM forecasts. The complete held-out gold code set is supplied only for post-generation evaluation. All generators were target-blind. Symmetric set rule Prediction-set evaluation is fixed and symmetric: every false prediction and every missed gold code receives zero reason utility. Do not let fluent prose, confidence, citations, or medical plausibility rescue either error. Score only reasons attached to true-positive predicted codes because only a correct set prediction can earn reason utility. Item blindingEach anonymous_reason_item is independently shuffled and may come from any system. The opaque item_id contains no model identity. You are not shown the originating system’s prediction set, TP count, FP count, FN count, rank, or confidence. Do not group items by writing style or infer generator identity. Score each reason on its own content. Five exact dimensions Clinical validity: Are the medical relationships, mechanisms, and claims clinically sound and free of substantive contradiction or hallucination? Gold occurrence proves that the code appeared, not that the stated medical mechanism is correct. Patient grounding: Are all patient-specific claims explicitly supported by the observed pre-target trajectory, without importing held-out encounter facts or inventing symptoms, tests, diagnoses, treatments, or plans? Next-encounter relevance: Does the reason explain why this code is likely to be documented in the immediately held-out admission, instead of merely defining the code, restating history, or asserting generic chronic carry-forward? ICD alignment: Does the reason match the exact ICD entity and its level of specificity, rather than a neighboring diagnosis, symptom, complication, procedure, or broader code family? Evidential calibration: Does the reason clearly separate observed patient facts, general medical knowledge or cited relations, and the forecast hypothesis; avoid treating association as patient-specific certainty; and express uncertainty proportionate to the available support? If citations are supplied, judge whether they entail the claim attributed to them. Citation absence alone must not lower this score when the trajectory itself provides adequate support. Scale/outputShared rubric: 5 complete, precise, and without a substantive flaw; 4 strong with one minor limitation; 3 plausible but partial or generic; 2 major gaps, weak support, or notable mismatch; 1 materially misleading; 0 absent, unusable, contradicted, or incompatible with the trajectory or exact ICD entity. Score dimensions independently, use the full scale, and do not infer system or model identity. Assess each listed true-positive reason exactly once and return JSON only. The strict response schema requires all five integers and one concise_reason per opaque item ID. Dynamic payload/retry Code system, observed pre-target context, complete gold set with titles, and independently shuffled anonymous true-positive reasons. The judge sees no method names. Validation failures append: “Prior validation errors: <feedback>. Return corrected complete JSON.” S8 Case Studies The selected execution traces preserve the frozen row identifier, functional role, prediction outcome, and quoted or reconstructed output used in the analysis. Intervening candidate lists are marked when omitted for length. The cases illustrate candidate expansion, joint ranking, explanation alignment, and safety failures. All explanation traces labeled ICD-Deepresearch are RRF-selected archival outputs; they do not represent the full Evidence-Aware selector. Table S24. Selected qualitative forecasting and explanation traces. Panel A compares ICD-Deepresearch: Direct Forecast Only with ICD-Deepresearch (RRF-selected) on a shared true-positive code; the latter has the legacy label AF/Union+RRF in the saved records. Panels B–C follow productive and failed Research Expansion; Panel D shows how Direct Forecast Only, Research Path Only, and ICD-Deepresearch w/o Evidence-Aware Reranker contribute different true positives. Metrics and gold membership are revealed only in the evaluation rows. Trace Function / view Selected output and interpretation Panel A. Explanation case, MIMIC-IV row 45 — correcting a fluent ICD-entity error A0Observed recordA 32-year-old woman has repeated pregnancy-related records containing uterine leiomyoma (D25.9), maternal care for benign uterine tumor in the second trimester (O34.12), and later third-trimester obstetric care. O34.13 is a held-out true positive; neither explanation generator saw the gold set. A1GPT-5 (Direct Forecasting) “Maternal care for uterine scar from prior surgery was previously noted (O34.12), so a future third-trimester pregnancy could warrant this code if the scar is not specifically attributed to cesarean or is coded under the broader uterine-scar category.” The explanation treats O34.12 as a uterine-scar code rather than maternal care for a benign uterine tumor. A2ICD- Deepresearch (RRF-selected) “She has leiomyoma and previously required maternal care for a benign uterine tumor; if pregnant again into the third trimester with fibroids affecting management, O34.13 would apply [15].” Source [15] resolves to the exact local ICD-10-CM title. The uncertainty statement correctly conditions the forecast on a future third-trimester pregnancy and active management. A3Automated gold-aware Reason5 judge ICD-Deepresearch (RRF-selected) receives clinical validity/patient grounding/next-encounter relevance/ICD alignment/evidential-calibration scores of 5/5/4/5/5; GPT-5 (Direct Forecasting) receives 0/1/1/0/1. After outputs are frozen, the method-blind GPT-5 judge receives the gold set, identifies the scar–tumor conflation, and assigns higher scores to the richer-input ICD-Deepresearch explanation. A4InterpretationThe ICD-Deepresearch writer receives the canonical entity represented by Source [15], while the observed obstetric trajectory supplies the patient and temporal bridge. This selected-case contrast does not isolate which additional input field causes the score difference. Panel B. Productive expansion, MIMIC-IV row 52 — four hits among eight additions B0Research Round 1 state The Candidate Generation Only K = 20 prediction matches 5/21 held-out codes. Research Round 1 expands the set to 50 candidates and 11 held-out matches, raising natural recall from .238 to .524. B1Research Round 2 planner Selected relation queries include Waldenstrom macroglobulinemia relapse progression outcomes, pancytopenia chemotherapy infection complications, hypernatremia dehydration neurologic complication timing, and hypomagnesemia arrhythmia complication incidence. B2Mapper and judge Eight candidates are accepted. I50.32 chronic diastolic heart failure, I11.0 hypertensive heart disease with heart failure, R73.9 hyperglycemia, and R91.1 solitary pulmonary nodule are held-out matches. G62.0, N05.8, T38.0X5A, and D73.89 are false additions. The saved discovery-evidence list is empty, identifying this as a candidate-construction and validation trace. B3Explanation writer For I50.32: “Explicitly documented in recent history alongside hypertension and hypertensive heart disease, indicating a persistent chronic HFpEF condition that is likely to be redocumented [2].” The uncertainty notes that reassessment or quiescence may alter documentation. Citation [2] defines the code; the persistence claim is attributed to the pre-target record. Continued on the next page. Supplementary Table S24 continued from the previous page. Trace Function / view Selected output and interpretation B4EvaluatorThe final natural set has 15/21 held-out codes: P/R/F1=.259/.714/.380. The 4/8 marginal hit rate improves F1. Direct Forecast Only, Research Path Only, and ICD-Deepresearch w/o Evidence-Aware Reranker each recover 11/21 at K = 20, illustrating the distinction between natural-cardinality expansion and fixed-budget ranking. Panel C. Failed expansion, MIMIC-IV row 59 — credible relations attached to invented anchors C0Research Round 2 planner The initial plan concerns hepatitis progression, COPD recurrence, migraine chronicity, autonomic dysfunction, substance relapse, stimulant complications, and constipation. The accepted candidates later drift toward lipids, GERD, back pain, diabetes, and hypertension. C1Mapper and judge E78.5 is accepted from the claimed anchor “LDL 162 mg/dL; atorvastatin started and continued” plus readable PMC articles on long-term statin persistence. The structured patient input contains no LDL, medication, or visit text. The sources support population treatment persistence, not this patient’s premise. C2Mapper and judge K21.9 uses an absent “heartburn >3 months; daily omeprazole” anchor despite a medically relevant GERD natural-history source. M54.5 uses an absent multi-year low-back-pain history despite a review of recurrent back pain. In both cases a valid relation is attached to an unresolved patient claim. Six further false additions are omitted for length: J02.9, E66.09, R07.9, E11.9, I10, and G47.00. Several rely only on dictionary definitions or reverse the immediate-horizon direction. C3EvaluatorAll nine Research Round 2 additions are absent from the held-out encounter. Natural recall remains .846, while precision falls .224→.190 and F1 falls .355→.310 as set size grows 49→58. C4Required correction Resolve every candidate anchor to an immutable event identifier or exact pre-target record span before search, then verify source entailment and immediate-horizon direction as separate checks. Panel D. Direct forecast and RRF-fusion case, MIMIC-IV row 62 — complementary rank paths D0ICD- Deepresearch: Direct Forecast Only E27.40 adrenocortical insufficiency is ranked 19th by Direct Forecast Only but 25th by Research Path Only. Its saved reason states that the diagnosis appears repeatedly and may be coded again while acknowledging that imminent adrenal decompensation is not established. Direct Forecast Only obtains 5 true positives and F1@20=.286. D1ICD- Deepresearch: Research Path Only F32.9 major depression and Z87.891 personal history of nicotine dependence are ranked 5th and 10th by research but only 28th and 27th by Direct Forecast Only. Research Path Only obtains 6 true positives and F1@20=.343. D2ICD- Deepresearch w/o Evidence-Aware Reranker E27.40 enters through the direct rank; F32.9 and Z87.891 enter through research; E87.0 hyperosmolality/hypernatremia is promoted to rank 20 from moderate component ranks 25/23 by agreement. D3EvaluatorICD-Deepresearch w/o Evidence-Aware Reranker obtains 8 true positives and P/R/F1=.400/.533/.457. The trace illustrates candidate and rank complementarity in this case. Complete Paired Explanation Output Table S25 reproduces the complete K = 20 explanation output for GPT-5 (Direct Forecasting) and ICD-Deepresearch (RRF- selected) in the selected MIMIC-IV case. Wording is preserved from the saved records; only Unicode quotation marks and dash characters are normalized for L A T E X. TP and FP are post-hoc annotations added after generation. Both explanation writers use gpt-5-2025-08-07; the supplied prediction and evidence states differ. Table S25. Complete explanation outputs for MIMIC-IV row 45. The exact same pre-target record is used by GPT-5 (Direct Forecasting) and ICD-Deepresearch (RRF-selected), while the ICD-Deepresearch writer also receives canonical code information, candidate clues, and ledger fields; the held-out target contains 15 ICD-10-CM codes. Every one of the 20 code-level rationales and uncertainty statements is shown. The ICD-Deepresearch source IDs are expanded in place so that each citation is inspectable. IDPredicted code / outcomeComplete explanation output Panel A. Frozen input and post-hoc target A0Pre-target historyAge 32, female. Visit 1: O34.32, D25.9, D57.3, Z3A.26, Z37.0, O32.8X0, O26.852, O42.912, and O34.12; procedure 10D00Z1. Visit 2: O86.12, O86.89, R78.81, and B95.61. Visit 3: O34.33, O26.893, Z3A.36, O99.013, and D57.3. A1Held-out goldO34.211, Z37.0, N85.8, O69.81X0, O32.6X0, O70.1, O34.13, D25.1, D25.2, O99.03, D57.3, O76, O99.89, R55, Z3A.38. The gold set is disclosed only for this retrospective case audit. Panel B. GPT-5 (Direct Forecasting): all 20 explanations D01O34.33 Maternal care for cervical incompetence, third trimester Post-hoc: FP Rationale. Prior records show maternal care for scar from previous cesarean (O34.32, O34.33) and a documented cesarean delivery, so a future third-trimester pregnancy could require care for a prior C-section scar. Uncertainty. Future pregnancy and trimester at the next admission are unknown, so this condition may not be applicable. Evidence returned. None (the frozen output contains an empty citation-ID list). D02Z98.891 History of uterine scar from previous surgery Post-hoc: FP Rationale. History includes a cesarean section (procedure 10D00Z1) and repeated documentation of uterine/cesarean scar, supporting a personal history of uterine scar from prior surgery. Uncertainty. Whether the next admission will document or require coding of this historical condition is uncertain. Evidence returned. None (the frozen output contains an empty citation-ID list). D03D25.9 Leiomyoma of uterus, unspecified Post-hoc: FP Rationale. Leiomyoma of uterus (D25.9) is documented previously and typically persists, making it reasonable to appear again on a subsequent admission if relevant to care. Uncertainty. The presence or clinical relevance of fibroids at the next encounter is not guaranteed. Evidence returned. None (the frozen output contains an empty citation-ID list). D04O34.13 Maternal care for benign tumor of corpus uteri, third trimester Post-hoc: TP Rationale. Maternal care for uterine scar from prior surgery was previously noted (O34.12), so a future third-trimester pregnancy could warrant this code if the scar is not specifically attributed to cesarean or is coded under the broader uterine-scar category. Uncertainty. It is unclear whether a future pregnancy will occur or whether coding will favor the cesarean-scar-specific code instead. Evidence returned. None (the frozen output contains an empty citation-ID list). D05D57.3 Sickle-cell trait Post-hoc: TP Rationale. Sickle-cell trait (D57.3) is repeatedly documented, a chronic lifelong condition likely to be recoded if pertinent to a future admission or pregnancy. Uncertainty. It may not be assessed or clinically relevant during the next admission. Evidence returned. None (the frozen output contains an empty citation-ID list). D06O99.019 Anemia complicating pregnancy, unspecified trimester Post-hoc: FP Rationale. Anemia complicating pregnancy in the third trimester (O99.013) was recorded previously, so anemia complicating pregnancy (unspecified trimester) could recur or be documented if trimester is not specified. Uncertainty. Next admission may not involve pregnancy or anemia, and documentation specificity may differ. Evidence returned. None (the frozen output contains an empty citation-ID list). Continued on the next page. Supplementary Table S25 continued from the previous page. IDPredicted code / outcomeComplete explanation output D07D50.9 Iron deficiency anemia, unspecified Post-hoc: FP Rationale. Anemia in pregnancy was noted previously; iron-deficiency anemia (D50.9) is a common underlying cause that might be identified or recoded on a subsequent admission. Uncertainty. No direct prior code for iron deficiency exists in the record, so etiology at the next admission is uncertain. Evidence returned. None (the frozen output contains an empty citation-ID list). D08O32.8X0 Maternal care for other malpresentation of fetus, not applicable or unspecified Post-hoc: FP Rationale. Prior pregnancy included fetal malpresentation (O32.8X0), which can recur in later pregnancies and prompt maternal care for malpresentation. Uncertainty. Future pregnancy and fetal presentation are unknown. Evidence returned. None (the frozen output contains an empty citation-ID list). D09O42.90 Premature rupture of membranes, unspecified as to length of time between rupture and onset of labor, unspecified weeks of gestation Post-hoc: FP Rationale. History includes premature rupture of membranes (O42.912); PROM can recur in subsequent pregnancies and may be coded with unspecified timing if details are unclear. Uncertainty. Whether a future pregnancy will have PROM, and whether timing will be documented, is uncertain. Evidence returned. None (the frozen output contains an empty citation-ID list). D10O85 Puerperal sepsis Post-hoc: FP Rationale. Postpartum infections including endometritis (O86.12), other puerperal infection (O86.89), and bacteremia (R78.81) with MSSA (B95.61) were documented, indicating risk for severe puerperal infection such as puerperal sepsis in a future delivery admission. Uncertainty. Sepsis may not occur in a subsequent puerperium, and infection severity cannot be predicted from prior history alone. Evidence returned. None (the frozen output contains an empty citation-ID list). D11B95.61 Methicillin susceptible Staphylococcus aureus infection as the cause of diseases classified elsewhere Post-hoc: FP Rationale. Prior records show bacteremia and obstetric sepsis with likely genitourinary source; E. coli is a common etiologic organism for postpartum and pregnancy-related UTIs/wound infections, so a related organism code could recur on readmission. Uncertainty. No culture results or organism documentation for the future admission are available to confirm E. coli causation. Evidence returned. None (the frozen output contains an empty citation-ID list). D12R78.81 Bacteremia Post-hoc: FP Rationale. History includes bacteremia during the peripartum period, placing the patient at risk for recurrence or evaluation for bloodstream infection on a subsequent admission. Uncertainty. No future blood culture data or systemic infection signs are provided to verify bacteremia. Evidence returned. None (the frozen output contains an empty citation-ID list). D13O23.40 Unspecified infection of urinary tract in pregnancy, unspecified trimester Post-hoc: FP Rationale. Pregnancy at 26 and 36 weeks was documented, and UTIs are common in pregnancy, especially with prior sepsis/possible E. coli, supporting a potential coding of genitourinary infection complicating pregnancy (unspecified trimester). Uncertainty. Trimester and clinical confirmation of a pregnancy-associated UTI at the next visit are not documented. Evidence returned. None (the frozen output contains an empty citation-ID list). D14N39.0 Urinary tract infection, site not specified Post-hoc: FP Rationale. Given prior bacteremia and likely genitourinary source, a nonspecific urinary tract infection could be the focus of a subsequent admission. Uncertainty. No urinalysis, culture, or urinary symptoms from the future encounter are provided. Evidence returned. None (the frozen output contains an empty citation-ID list). D15Z37.0 Single live birth Post-hoc: TP Rationale. The chart shows late pregnancy (36 weeks) and prior singleton live birth; the next/final admission could be for another delivery resulting in a single liveborn outcome. Uncertainty. Actual delivery outcome and plurality for the upcoming admission are unknown. Evidence returned. None (the frozen output contains an empty citation-ID list). Continued on the next page. Supplementary Table S25 continued from the previous page. IDPredicted code / outcomeComplete explanation output D16O26.899 Other specified pregnancy related conditions, unspecified trimester Post-hoc: FP Rationale. Patient had multiple pregnancy-related complications coded previously (e.g., O26.893/O26.852), so another nonspecific pregnancy-related condition may be coded on a later admission when details are limited. Uncertainty. The specific nature and timing of any new pregnancy-related complication are not provided. Evidence returned. None (the frozen output contains an empty citation-ID list). D17O26.90 Pregnancy related conditions, unspecified, unspecified trimester Post-hoc: FP Rationale. Given recurring pregnancy complication codes in prior encounters, an unspecified pregnancy-related condition code may again be used if the condition is present but not further specified on admission. Uncertainty. No explicit clinical problem is described to justify an unspecified pregnancy complication at the future visit. Evidence returned. None (the frozen output contains an empty citation-ID list). D18Z3A.36 36 weeks gestation of pregnancy Post-hoc: FP Rationale. Gestational age of 36 weeks was recorded in late pregnancy; a near-term readmission around the same gestation often carries a Z3A36 dating code. Uncertainty. Exact gestational age at the time of the next/final admission is not known. Evidence returned. None (the frozen output contains an empty citation-ID list). D19O86.00 Infection of obstetric surgical wound, unspecified Post-hoc: FP Rationale. Previous cesarean delivery and puerperal sepsis increase risk for postpartum/obstetric surgical wound infection, which may prompt readmission and coding of an unspecified obstetric wound infection. Uncertainty. No wound findings or postoperative exam from the future admission confirm a surgical site infection. Evidence returned. None (the frozen output contains an empty citation-ID list). D20O90.81 Anemia of the puerperium Post-hoc: FP Rationale. Following cesarean delivery and puerperal complications, additional specified puerperal complications may occur and require admission, aligning with an O90.81-type postpartum complication code. Uncertainty. The specific postpartum condition, timing, and diagnostic evidence for O90.81 at the next encounter are not detailed. Evidence returned. None (the frozen output contains an empty citation-ID list). Panel C. ICD-Deepresearch (RRF-selected): all 20 explanations R01D25.9 Leiomyoma of uterus, unspecified Post-hoc: FP Rationale. She previously carried uterine leiomyoma (fibroids), which can remain clinically relevant across pregnancies and postpartum care; documentation of leiomyoma again would align with D25.9 if noted on the next admission [1]. Uncertainty. Only applicable if fibroids are re-documented as an active condition or influencing care on the next encounter. Source [1]. D25.9 Leiomyoma of uterus, unspecified; https://w.icd10data.com/search?s=D25.9. Recorded role: icd_definition. R02O34.33 Maternal care for cervical incompetence, third trimester Post-hoc: FP Rationale. She had prior care for cervical incompetence (second trimester O34.32) and later third-trimester care (O34.33) was recorded, so a future pregnancy complicated by cervical incompetence in the third trimester could warrant this code if managed again [2]. Uncertainty. Requires a subsequent pregnancy with documented cervical insufficiency care in the third trimester. Source [2]. O34.33 Maternal care for cervical incompetence, third trimester; https://w.icd10data.com/search?s=O34.33. Recorded role: icd_definition. R03R78.81 Bacteremia Post-hoc: FP Rationale. Bacteremia was documented previously, and a new episode would be coded again if blood cultures show bacteria in the bloodstream on a future admission [3]. Uncertainty. Only coded if recurrent or new bloodstream bacteremia is documented. Source [3]. R78.81 Bacteremia; https://w.icd10data.com/search?s=R78.81. Recorded role: icd_definition. R04B95.61 Methicillin susceptible Staphylococcus aureus infection as the cause of diseases classified elsewhere Post-hoc: FP Rationale. MSSA (B95.61) was previously identified as the causative organism; if a future infection is attributed to MSSA, this organism code would again accompany the primary infectious diagnosis [4]. Uncertainty. Contingent on a new infection being microbiologically linked to MSSA. Source [4]. B95.61 Methicillin susceptible Staphylococcus aureus infection as the cause of diseases classified elsewhere; https://w.icd10data.com/search?s=B95.61. Recorded role: icd_definition. Continued on the next page. Supplementary Table S25 continued from the previous page. IDPredicted code / outcomeComplete explanation output R05D57.3 Sickle-cell trait Post-hoc: TP Rationale. Sickle-cell trait was documented on multiple encounters and is a lifelong hematologic status that commonly remains on problem lists or prenatal records when relevant [5]. Uncertainty. Will appear only if clinicians carry forward or reconfirm the trait as pertinent to care. Source [5]. D57.3 Sickle-cell trait; https://w.icd10data.com/search?s=D57.3. Recorded role: icd_definition. R06Z37.0 Single live birth Post-hoc: TP Rationale. She previously had a single live birth; if the next admission is a delivery resulting in one liveborn infant, Z37.0 would document that outcome again [6]. Uncertainty. Applicable only if the next hospitalization is for delivery with a singleton liveborn outcome. Source [6]. Z37.0 Single live birth; https://w.icd10data.com/search?s=Z37.0. Recorded role: icd_definition. R07O32.8X0 Maternal care for other malpresentation of fetus, not applicable or unspecified Post-hoc: FP Rationale. Prior records included antenatal care for fetal malpresentation; recurrence of a non-specific malpresentation in a future pregnancy could prompt this unspecified malpresentation care code [7]. Uncertainty. Depends on a future pregnancy with documented malpresentation requiring maternal care. Source [7]. O32.8X0 Maternal care for other malpresentation of fetus, not applicable or unspecified; https://w.icd10data.com/search?s=O32.8X0. Recorded role: icd_definition. R08Z3A.36 36 weeks gestation of pregnancy Post-hoc: FP Rationale. She was previously seen at 36 weeks’ gestation; if a future encounter occurs at 36 weeks, gestational age would again be captured with Z3A.36 [8]. Uncertainty. Only used if the timing of a subsequent pregnancy admission is specifically at 36 weeks. Source [8]. Z3A.36 36 weeks gestation of pregnancy; https://w.icd10data.com/search?s=Z3A.36. Recorded role: icd_definition. R09O85 Puerperal sepsis Post-hoc: FP Rationale. She had postpartum infections and bacteremia after delivery in prior care; if a future postpartum admission meets criteria for puerperal sepsis, O85 would capture that complication [9]. Uncertainty. Requires new postpartum sepsis; prior infection alone does not ensure recurrence. Source [9]. O85 Puerperal sepsis; https://w.icd10data.com/search?s=O85. Recorded role: icd_definition. R10O86.12 Endometritis following delivery Post-hoc: FP Rationale. Endometritis following delivery was previously coded; a subsequent postpartum endometritis episode after a future birth would again be captured with O86.12 [12]. Uncertainty. Only applicable if a new post-delivery endometritis is documented. Source [12]. O86.12 Endometritis following delivery; https://w.icd10data.com/search?s=O86.12. Recorded role: icd_definition. R11O86.89 Other specified puerperal infections Post-hoc: FP Rationale. Other specified puerperal infections were in her history; a future postpartum infection not classified elsewhere could be coded again with O86.89 [13]. Uncertainty. Requires documentation of a new specified puerperal infection postpartum. Source [13]. O86.89 Other specified puerperal infections; https://w.icd10data.com/search?s=O86.89. Recorded role: icd_definition. R12Z98.891 History of uterine scar from previous surgery Post-hoc: FP Rationale. History of a uterine surgical scar (e.g., prior cesarean or myomectomy) is a persistent status; if such a scar is documented, this status code may be carried forward on future obstetric admissions [14]. Uncertainty. Only appropriate if records confirm a prior uterine surgery resulting in a scar. Source [14]. Z98.891 History of uterine scar from previous surgery; https://w.icd10data.com/search?s=Z98.891. Recorded role: icd_definition. Continued on the next page. Supplementary Table S25 continued from the previous page. IDPredicted code / outcomeComplete explanation output R13O34.13 Maternal care for benign tumor of corpus uteri, third trimester Post-hoc: TP Rationale. She has leiomyoma and previously required maternal care for a benign uterine tumor; if pregnant again into the third trimester with fibroids affecting management, O34.13 would apply [15]. Uncertainty. Depends on third-trimester pregnancy with active management implications from fibroids. Source [15]. O34.13 Maternal care for benign tumor of corpus uteri, third trimester; https://w.icd10data.com/search?s=O34.13. Recorded role: icd_definition. R14O99.013 Anemia complicating pregnancy, third trimester Post-hoc: FP Rationale. Anemia complicating pregnancy, third trimester, was previously documented; recurrence in a future third-trimester pregnancy would again warrant O99.013 [16]. Uncertainty. Requires a subsequent pregnancy with third-trimester anemia impacting care. Source [16]. O99.013 Anemia complicating pregnancy, third trimester; https://w.icd10data.com/search?s=O99.013. Recorded role: icd_definition. R15O99.019 Anemia complicating pregnancy, unspecified trimester Post-hoc: FP Rationale. If anemia complicates a future pregnancy but trimester is not specified in documentation, O99.019 captures that unspecified-trimester complication [17]. Uncertainty. Used only if pregnancy-related anemia is present and the trimester is not documented. Source [17]. O99.019 Anemia complicating pregnancy, unspecified trimester; https://w.icd10data.com/search?s=O99.019. Recorded role: icd_definition. R16D50.9 Iron deficiency anemia, unspecified Post-hoc: FP Rationale. If future evaluation shows iron deficiency as the cause of anemia, D50.9 would document unspecified iron deficiency anemia alongside pregnancy-related codes as appropriate [18]. Uncertainty. Applicable only with documentation or labs supporting iron deficiency anemia. Source [18]. D50.9 Iron deficiency anemia, unspecified; https://w.icd10data.com/search?s=D50.9. Recorded role: icd_definition. R17O42.90 Premature rupture of membranes, unspecified as to length of time between rupture and onset of labor, unspecified weeks of gestation Post-hoc: FP Rationale. Should a future pregnancy be complicated by premature rupture of membranes with unspecified latency and gestational week, O42.90 would capture that event [19]. Uncertainty. Contingent on clear PROM documentation meeting this unspecified description. Source [19]. O42.90 Premature rupture of membranes, unspecified as to length of time between rupture and onset of labor, unspecified weeks of gestation; https://w.icd10data.com/search?s=O42.90. Recorded role: icd_definition. R18O34.12 Maternal care for benign tumor of corpus uteri, second trimester Post-hoc: FP Rationale. She previously had maternal care for a benign uterine tumor in the second trimester; recurrence in the second trimester of a future pregnancy could again be coded O34.12 [20]. Uncertainty. Requires a subsequent second-trimester pregnancy with fibroid-related management. Source [20]. O34.12 Maternal care for benign tumor of corpus uteri, second trimester; https://w.icd10data.com/search?s=O34.12. Recorded role: icd_definition. R19O34.32 Maternal care for cervical incompetence, second trimester Post-hoc: FP Rationale. Maternal care for cervical incompetence in the second trimester was recorded before; if cervical insufficiency again requires care in a future second trimester, O34.32 would apply [21]. Uncertainty. Only applicable with renewed documentation of second-trimester cervical incompetence care. Source [21]. O34.32 Maternal care for cervical incompetence, second trimester; https://w.icd10data.com/search?s=O34.32. Recorded role: icd_definition. R20O23.40 Unspecified infection of urinary tract in pregnancy, unspecified trimester Post-hoc: FP Rationale. If a future pregnancy is complicated by a urinary tract infection without trimester specified, O23.40 would document that condition [22]. Uncertainty. Used only if a pregnancy-associated UTI is diagnosed and trimester remains unspecified. Source [22]. O23.40 Unspecified infection of urinary tract in pregnancy, unspecified trimester; https://w.icd10data.com/search?s=O23.40. Recorded role: icd_definition. Table S26. Gold-aware automated comparison of the complete row-45 explanation outputs. Reason5 values are means over the three shared true-positive codes (O34.13, D57.3, and Z37.0) under the frozen item-blind GPT-5 judge. The semantic audit counts explicit title–rationale contradictions visible in Table S25; ICD-Deepresearch (RRF-selected) receives the complete code-bound explanation input. Comparison axisGPT-5 (Direct Forecasting)ICD-Deepresearch (RRF-selected) What the automated audit shows Prediction outcome3/20 hits: O34.13, D57.3, Z37.0. P/R/F1=15.00/20.00/17.14%. 3/20 hits: D57.3, Z37.0, O34.13. P/R/F1=15.00/20.00/17.14%. Prediction quality is tied in this case; explanation quality must therefore be evaluated separately. Clinical validity3.33/55.00/5The automated-score difference coincides with the Direct O34.13 scar–tumor conflation; both configurations score 5/5 on the other two shared hits. Patient grounding3.67/55.00/5The richer-input ICD-Deepresearch explanation links O34.13 to observed leiomyoma/O34.12; GPT-5 (Direct Forecasting) links it to an incorrectly inferred uterine-scar entity. Next-encounter relevance 3.33/54.00/5Both outputs are conditional forecasts; the score difference reflects the specificity of the observed transition rationale. ICD alignment3.33/55.00/5GPT-5 (Direct Forecasting) misdescribes O34.33, O34.13, B95.61, and O90.81; the 20 ICD-Deepresearch rows preserve title–rationale consistency in this selected case. Evidential calibration 3.67/55.00/5Code-bound source IDs make the asserted ICD entity and definition traceable. Five-axis mean3.47/54.80/5On the three shared hits, the frozen GPT-5 judge assigns the richer-input ICD-Deepresearch explanation a 1.33-point higher mean. Citation trace0/20 explanations return a source ID. 20/20 explanations return an inspectable code-bound source ID. The ICD-Deepresearch source IDs make code identity inspectable. In this case, all cited sources are local ICD definitions, so the citation trace is confined to code identity. Remaining errors17/20 predictions are false positives; several explanations infer unobserved causes or future complications. 17/20 predictions are also false positives; many rationales remain conditional and weakly tied to the immediate encounter. The richer-input ICD-Deepresearch configuration receives higher automated alignment and calibration scores, while both methods retain substantial false-positive and horizon errors. Case interpretation. GPT-5 (Direct Forecasting) produces internally contradictory entity descriptions: it calls O34.33 and O34.13 uterine-scar codes, describes B95.61 as an E. coli organism code, and treats O90.81 as a generic puerperal complication. The ICD-Deepresearch (RRF-selected) writer receives the selected code title and exposes that title through a resolvable citation, connecting the observed fibroid trajectory to the correct O34.13 entity. The automated, gold-aware, method- blind GPT-5 Reason5 judge assigns the three shared hits a higher five-axis mean (4.80 versus 3.47). Both systems recover the same three gold codes at K = 20; the observed score difference is concentrated in code alignment and evidential calibration and does not isolate the effect of any single additional input field. Table S27. Selected paired retrieval traces from the metadata audit. Within each panel, Research Expansion and GPT-5 + Web Search (Standalone) operate on the same patient row. The rows reproduce recorded queries, source metadata, and metadata-proxy labels. CaseRetriever / judge Selected retrieval trace Panel A. MIMIC-I row 48 — newborn jaundice trajectory A1Archived research-path metadata Query: bilirubin total peak newborn phototherapy. Source: Guidelines for Phototherapy, Stanford Newborn Nursery, https://med.stanford.edu/newborns/professional-education/jaundice-and- phototherapy/guidelines-for-phototherapy.html. A2Archived proxy label Credible=yes; patient-relevant=yes; forecast-useful=yes; coding-only=no; utility=direct. The metadata judge labels the phototherapy-threshold source as a possible near-term bridge from the query, title, URL, and pre-target record. A3GPT-5 + Web Search (Standalone) metadata Query: ICD-9-CM 771.81 septicemia of newborn code definition | 771.82 urinary tract infection | V29.0 observation. Source: Reddit Emergency Medicine thread, https://w.reddit.com/r/emergencymedicine/comments/1jx5rdi. A4Archived proxy label Credible=no; patient-relevant=no; forecast-useful=no; coding-only=no; utility=none. The metadata judge labels this forum source as lacking an authoritative next-visit bridge. Panel B. MIMIC-IV row 78 — diabetic foot-ulcer care B1Archived research-path metadata Query: poor glycemic control ulcer healing delay. Source: Reasonable Glycemic Control Would Help Wound Healing During the Treatment of Diabetic Foot Ulcers, PMC, https://pmc.ncbi.nlm.nih.gov/articles/PMC6349287/. B2Archived proxy label Credible=yes; patient-relevant=yes; forecast-useful=yes; coding-only=no; utility=indirect. The metadata judge labels the proposed glycemic-control/wound-healing relation as potentially relevant. B3GPT-5 + Web Search (Standalone) metadata Query: ICD-10-CM L97.418 definition | L97.419 definition | L02.611 definition | L03.115 definition. Source: Reddit Phlebotomy thread, https://w.reddit.com/r/phlebotomy/comments/1tk6dk6/can_somebody_ please_help_me_understand_icd_codes/. B4Archived proxy label Credible=no; patient-relevant=no; forecast-useful=no; coding-only=no; utility=none. The metadata judge labels this code-oriented forum source as lacking a concrete next-encounter transition. Panel C. MIMIC-IV row 62 — central-line surveillance C1Archived research-path metadata Query: indwelling central venous catheter surveillance outcomes. Source: A Two-Year Surveillance of Central Line-Associated Bloodstream Infections, PMC, https://pmc.ncbi.nlm.nih.gov/articles/PMC10577095/. C2Archived proxy label Credible=yes; patient-relevant=yes; forecast-useful=yes; coding-only=no; utility=direct. The metadata judge labels catheter-infection surveillance as potentially relevant. C3GPT-5 + Web Search (Standalone) metadata Query: ICD-10-CM hyperammonemia | metabolic encephalopathy G93.41 | esophageal varices | fluid overload E87.7. Source: Reddit AskDocs thread, https://w.reddit.com/r/AskDocs/comments/163f3rn. C4Archived proxy label Credible=no; patient-relevant=no; forecast-useful=no; coding-only=no; utility=none. The metadata judge labels this forum source as lacking authoritative next-visit guidance. DAggregate metadata audit Across 50 sampled retrieval occurrences per system/dataset cell, the forecast-proxy label is positive for 22% versus 6% on MIMIC-I and 36% versus 4% on MIMIC-IV. The audit unit is an occurrence represented by its query, title, URL, and pre-target record. S9 Cross-Case Error Analysis Table S28. Failure mechanisms and corresponding validation requirements derived from the saved case traces. MechanismObserved traceCurrent validation gapRequired correction Free-text anchor hallucination Row 59 invents LDL, HbA1c, medications, BP values, and symptom visits absent from its structured input. The judge receives the candidate’s anchor statement without an immutable source-span link. Candidate must return an event ID or exact quoted pre-target span; deterministic validation rejects unresolved anchors before search. Query–candidate drift Row 59’s initial plan concerns hepatitis, COPD, migraine, autonomic dysfunction, substance relapse, and constipation; accepted additions later concern lipids, GERD, back pain, diabetes, and hypertension. Mapping is allowed to “discover a supported consequence,” weakening traceability to the planned hypothesis. Assign a hypothesis ID and require every candidate, query, source, and verdict to preserve that ID; new hypotheses must trigger a new planning pass. Definition– forecast conflation Row 52 true additions and several row 59 false additions cite dictionary pages as their only accepted evidence. Exact code validation is represented beside clinical evidence and may be read as additive support. Store definition, patient_anchor, and relation_evidence in separate channels; definitions contribute zero forecast confidence. Semantic mapping mismatch R73.9 is described as abnormal liver enzymes, G62.0 as alcoholic neuropathy, and D73.89 as anemia despite conflicting dictionary titles. Validation checks that a code exists, not that model term, hypothesis, anchor, and dictionary entity agree. Add bidirectional semantic entailment checks over code title↔ candidate term ↔ patient anchor; reject mismatched site, cause, status, or entity. Horizon-polarity error Row 59 accepts acute pharyngitis while its own hypothesis and sources describe a self-limited episode. The current relation label conflates persistence or recurrence with resolution. Verifier must label the relation as persistence, recurrence, emergence, resolution, or contraindication and require positive immediate-horizon polarity. Uncontrolled cardinality Row 52’s 4/8 Research Round 2 yield improves F1; row 59’s 0/9 Research Round 2 yield necessarily lowers F1. Candidate acceptance is local; the observed break-even statistic is available only after held-out targets are revealed. Learn any retention rule on disjoint development data, freeze it before evaluation, and compare it with fixed-budget controls; preserve failed-query and negative-evidence states for ranking. The cases diagnose internal failure modes of Research Expansion and support a three-link contract: resolvable pre-target anchor → source-entailed directional relation → exact immediate-horizon ICD candidate. Row 52 recovers candidates but exposes mapping errors and definition-only support; row 59 breaks the anchor and horizon links; and in row 62 the RRF selector retains true positives available at complementary ranks in the two branches. The final observation is a single-case illustration, not an estimate of a general RRF effect. The taxonomy complements the component controls by locating errors in anchoring, relation direction, code mapping, and retention.