Organizations: Independent Researcher · National Institute for Data Science in Health and Medicine, Xiamen University, Xiamen, China · Yue’erwan Internet Hospital Co., Ltd. · School of Biomedical Engineering, Tsinghua University, Beijing, China · National University of Singapore, Singapore · Yttrium-90 Precision Interventional Radiotherapy Center of Liver Cancer, Beijing Tsinghua Changgung Hospital, School of Clinical Medicine, Tsinghua University, Beijing, China · Hepatobiliary and Pancreatic Centre, Beijing Tsinghua Changgung Hospital, School of Clinical Medicine, Tsinghua University, Beijing, China
Large language model (LLM) agents extend generative models with reasoning, tool use, and persistent memory, thereby enabling the automation of complex tasks. In healthcare, such systems could support documentation, care coordination, and clinical decision making. Their reliable deployment in hospitals, however, remains constrained by safety risks, limited transparency, and inadequate mechanisms for handling longitudinal clinical context. Here we propose an architecture that adapts LLM agents to hospital environments. The design comprises four components: a restricted execution environment inspired by multi-user operating systems, a document-centric interaction model linking patient and clinician agents, a page-indexed memory architecture for longitudinal context management, and a curated library of composable medical skills. Implemented on top of OpenClaw, an open-source agent orchestration framework, this design provides the basis for an Agentic Operating System for Hospitals: a computing layer for coordinating clinical workflows while preserving safety, transparency, and auditability. To evaluate the memory component, we introduce manifest-guided retrieval for hierarchical navigation of longitudinal patient records. In a benchmark derived from the MIMIC-IV dataset (v2.2) comprising 100 de-identified patient records and 300 clinical queries stratified across three difficulty tiers (100 per tier), manifest-guided retrieval matched a metadata-filtered RAG baseline on overall recall (0.877 versus 0.876) while achieving 2.2x higher precision (0.779 versus 0.352) and retrieving fewer documents; on tier-3 longitudinal queries, manifest recall was 21% higher (0.846 versus 0.701), confirming that LLM-guided hierarchical navigation is most valuable when queries span multiple care episodes. These results outline a practical path toward hospital-scale agentic infrastructure.
Figures & tables
Figure 1: Architecture of the Agentic Operating System for Hospitals. The system comprises three layers. ( Agent Layer ) Each participant role—patient, clinician, triage, specialist—maps to a dedicated agent process executing within an OS-enforced isolated namespace; agents interact with the environment solely through two operations: invoking pre-audited medical skills and reading or writing shared clinical documents. ( Interface Layer ) The Medical Skills Library exposes a curated set of statically typed workflow modules; the Document Store maintains per-role document collections linked by an append-only mutation event stream dispatched by the Event Broker. ( OS Enforcement Layer ) Linux user isolation, file permission bits, seccomp filters, AppArmor policies, and the auditd / inotify subsystem collectively enforce all access boundaries at the kernel level, independent of model behaviour. Critically, no agent communicates with another through a direct channel; all inter-agent coordination is realised exclusively through document writes and event notifications.
Figure 2: Page-indexed memory architecture and progressive disclosure retrieval. ( Left ) The memory lifecycle consists of three stages: Capture (observations are written as structured pages), Store (pages are consolidated into a rooted document hierarchy with a manifest file at each internal node), and Recall (the agent navigates the hierarchy through successive manifest reads). ( Right ) The document tree is organised by patient, care episode, and document group; each internal node carries a manifest (badge M ) listing its children with natural-language scope descriptions, while leaf nodes contain primary clinical content. Given a query, the agent issues an LLM-Select call at each level to identify relevant subtrees (highlighted in green) and prune irrelevant branches without reading them (shown in grey, labelled “pruned”). This design requires no vector embeddings; retrieval accuracy depends solely on the agent’s language-reasoning capability applied to manifest text, and the sequence of manifests consulted constitutes an inherently interpretable access trace.
Figure 3: Clinical application scenarios enabled by the Agentic Operating System for Hospitals. The nine-panel grid illustrates representative use cases realised by the proposed architecture. The central panel summarises the four core mechanisms shared across all scenarios: least-privilege execution, document-mutation coordination, manifest-guided memory retrieval, and ad-hoc skill composition. The surrounding eight panels cover scheduled care ( Continuous Monitoring , Medication Management ), reactive workflows ( Triage , Emergency Escalation ), longitudinal analysis ( Proactive Risk Identification , Population Health ), multi-agent coordination ( Cross-Specialty Coordination ), and infrastructure ( Safety, Audit & Governance ). Each scenario is realised entirely through the composition of medical skills, document writes, event subscriptions, and manifest navigation—without any bespoke architectural extension. The diversity of use cases demonstrates that a single unified infrastructure layer is sufficient to address both routine and exceptional clinical needs across the full spectrum of hospital workflows.
System
Score
Precision
Recall
Perfect Recall
Docs Retrieved
Manifest
4.45
0.779
0.877
214/300
5.8
RAG-AF ( k=10 )
4.32
0.352
0.876
224/300
7.8
RAG ( k=10 )
3.85
0.231
0.647
124/300
9.7
Table 1: Overall comparison between manifest-guided retrieval, metadata-filtered RAG (RAG-AF), and flat RAG at k=10 . Higher is better for score, precision, recall, and perfect recall; lower is better for retrieved documents.
Tier
System
Score
Precision
Recall
Perfect Recall
Docs
1
Manifest
4.76
0.860
0.870
87/100
1.0
RAG-AF ( k=10 )
4.72
0.167
0.960
96/100
6.6
RAG ( k=10 )
3.88
0.069
0.640
64/100
9.7
2
Manifest
4.47
0.840
0.913
74/100
3.5
RAG-AF ( k=10 )
4.28
0.441
0.967
91/100
7.0
RAG ( k=10 )
3.88
0.193
0.626
30/100
9.7
Table 2: Per-tier comparison across manifest-guided retrieval, metadata-filtered RAG (RAG-AF), and flat RAG at k=10 . Manifest advantages are most pronounced on Tier-3 longitudinal queries.
System
Precision
Recall
Perfect Recall
Docs Retrieved
Score
RAG ( k=5 )
0.291
0.439
59/300
5.0
3.28
RAG ( k=10 )
0.231
0.647
124/300
9.7
3.85
RAG ( k=15 )
0.186
0.738
165/300
14.3
3.95
RAG-AF ( k=5 )
0.466
0.768
179/300
4.6
4.11
RAG-AF ( k=10 )
0.352
0.876
224/300
7.8
4.32
RAG-AF ( k=15 )
0.305
0.912
244/300
9.8
4.33
Table 3: RAG sensitivity to k for both flat and metadata-filtered (RAG-AF) variants. Manifest results (from Table 1 ) are shown for reference. Score denotes a supporting LLM-judge answer-quality rating (1–5 scale).
System
Structural awareness
Precision
Recall
Perfect Recall
Docs
RAG ( k=10 )
Dense retrieval only
0.231
0.647
124/300
9.7
RAG-AF ( k=10 )
+ admission metadata
0.352
0.876
224/300
7.8
Manifest L1 only
+ LLM episode selection
0.238
0.977
276/300
22.2
Manifest L1+L2
+ LLM document selection
0.779
0.877
214/300
5.8
Table 4: Structural awareness ablation. Each row uses progressively richer structural information from the clinical record.
Field
Value
Query
How did S19768128’s lactate levels change from the initial craniotomy admission to the later readmission for surgical site infection?
Table 5: Example manifest trace for Q289. The trace shows the selected patient, admission nodes, and leaf documents used to answer a longitudinal lactate-monitoring query on real MIMIC-IV data.
Division of AI Support for Medical Research, Faculty of Medicine, Hokkaido University, Sapporo, Japan · Department of Cancer Pathology, Faculty of Medicine, Hokkaido University, Sapporo, Japan · Technoplasm Inc., Sapporo, Japan +5
Chief Operating Officer and Head of Research and Development, Instil-it, Hyderabad, Telangana. · Chief AI Architect Engineer, Instil-it, Hyderabad, Telangana · Chief Executive Officer, Managing Director and Chief Data Scientist, Instil-it, Hyderabad, Telangana