---
name: 'digital-twin-clinical-agent'
description: 'AI-powered patient digital twin creation for clinical trial simulation, treatment outcome prediction, and personalized medicine using real-world data and multi-omics integration.'
measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes.
allowed-tools:
  - read_file
  - run_shell_command
---

<!--
# COPYRIGHT NOTICE
# This file is part of the "Universal Biomedical Skills" project.
# Copyright (c) 2026 MD BABU MIA, PhD <md.babu.mia@mssm.edu>
# All Rights Reserved.
#
# This code is proprietary and confidential.
# Unauthorized copying of this file, via any medium is strictly prohibited.
#
# Provenance: Authenticated by MD BABU MIA

-->



# Digital Twin Clinical Agent

The **Digital Twin Clinical Agent** creates AI-powered virtual replicas of individual patients by integrating genomics, imaging, wearable data, and clinical records. These digital twins enable clinical trial simulation, treatment response prediction, and personalized therapeutic optimization, qualified by EMA and aligned with FDA guidance.

## When to Use This Skill

* When simulating clinical trial outcomes for drug development.
* For creating patient-specific treatment response predictions.
* To optimize clinical trial design and reduce sample sizes.
* When predicting individual patient trajectories.
* For personalized dosing and treatment selection.

## Core Capabilities

1. **Patient Digital Twin Creation**: Build comprehensive patient models.

2. **Clinical Trial Simulation**: Predict trial outcomes virtually.

3. **Treatment Response Prediction**: Individualized response modeling.

4. **Counterfactual Generation**: "What-if" treatment scenarios.

5. **Longitudinal Prediction**: Forecast disease trajectories.

6. **Trial Design Optimization**: Reduce sample sizes, improve power.

## Digital Twin Components

| Component | Data Sources | Models |
|-----------|--------------|--------|
| Genomic Twin | WES/WGS, RNA-seq | Mutation effects, expression |
| Phenotypic Twin | EHR, labs, vitals | Clinical trajectories |
| Imaging Twin | CT, MRI, pathology | Tumor dynamics |
| Behavioral Twin | Wearables, PROs | Activity, symptoms |
| Pharmacokinetic | Drug levels, metabolism | PK/PD models |

## Clinical Applications

| Application | Use Case | Benefit |
|-------------|----------|---------|
| Trial Simulation | Virtual control arms | Reduce placebo patients |
| Dose Optimization | Individual PK/PD | Personalized dosing |
| Treatment Selection | Compare therapies | Optimal choice |
| Progression Prediction | Disease trajectory | Early intervention |
| Drop-off Prediction | Compliance forecasting | Retention improvement |

## Workflow

1. **Data Collection**: Gather multi-modal patient data.

2. **Twin Construction**: Build integrated patient model.

3. **Calibration**: Fit twin to individual patient data.

4. **Validation**: Compare predictions to observations.

5. **Simulation**: Run treatment scenarios.

6. **Prediction**: Generate outcome forecasts.

7. **Output**: Digital twin model, predictions, uncertainties.

## Example Usage

**User**: "Create a digital twin for this Alzheimer's patient to simulate their response to the investigational drug and compare to placebo trajectory."

**Agent Action**:
```bash
python3 Skills/Clinical/Digital_Twin_Clinical_Agent/create_twin.py \
    --patient_data patient_ehr.json \
    --genomics patient_wgs.vcf \
    --imaging mri_series/ \
    --cognitive_scores mmse_history.csv \
    --biomarkers abeta_tau_nfl.csv \
    --disease alzheimers \
    --simulate_treatment drug_a \
    --compare_to placebo \
    --prediction_horizon 24_months \
    --output digital_twin_results/
```

## Input Requirements

| Data Type | Required | Purpose |
|-----------|----------|---------|
| Demographics | Yes | Base characteristics |
| Medical History | Yes | Disease context |
| Lab Values | Yes | Biomarker trajectories |
| Medications | Yes | Treatment history |
| Genomics | Recommended | Personalization |
| Imaging | Recommended | Disease state |
| Wearables | Optional | Real-time data |
| PROs | Optional | Symptom tracking |

## Output Components

| Output | Description | Format |
|--------|-------------|--------|
| Digital Twin Model | Serialized patient model | .pt, .pkl |
| Trajectory Predictions | Future state estimates | .csv |
| Counterfactuals | Alternative outcomes | .csv |
| Uncertainty Bounds | Prediction intervals | .json |
| Comparison Report | Treatment vs control | .pdf |
| Visualization | Interactive dashboard | .html |

## AI/ML Components

**Twin Generation**:
- Generative adversarial networks (ClinicalGAN)
- Variational autoencoders
- Large language models (DT-GPT)

**Trajectory Modeling**:
- Recurrent neural networks
- Temporal transformers
- Gaussian processes

**Treatment Effect**:
- Causal inference models
- Counterfactual prediction
- Potential outcomes framework

## Clinical Trial Applications

| Trial Phase | Digital Twin Role | Benefit |
|-------------|-------------------|---------|
| Phase I | Safety prediction | De-risk dosing |
| Phase II | Efficacy simulation | Go/no-go decisions |
| Phase III | Virtual control arm | Smaller trials |
| Post-marketing | Real-world outcomes | Safety monitoring |

## Regulatory Status

| Agency | Status | Application |
|--------|--------|-------------|
| FDA | Guidance supportive | Acceptable with validation |
| EMA | Qualified | Specific use cases approved |
| PMDA | Under evaluation | Pilot programs |

## Validation Requirements

| Validation Type | Method | Metric |
|-----------------|--------|--------|
| Temporal | Hold-out future data | RMSE, calibration |
| External | Independent cohort | Generalization |
| Subgroup | Demographic splits | Fairness |
| Extreme | Edge cases | Robustness |

## Prerequisites

* Python 3.10+
* PyTorch, TensorFlow
* Survival analysis libraries
* EHR parsing tools
* OMOP CDM familiarity

## Related Skills

* Virtual_Lab_Agent - AI research coordination
* Multimodal_Radpath_Fusion_Agent - Data integration
* Multi_Ancestry_PRS_Agent - Genetic risk
* ctDNA_Dynamics_MRD_Agent - Disease monitoring

## Disease-Specific Models

| Disease | Key Endpoints | Model Maturity |
|---------|---------------|----------------|
| Alzheimer's | ADAS-Cog, CDR | Advanced |
| Oncology | PFS, OS, ORR | Advanced |
| Cardiovascular | MACE, ejection fraction | Moderate |
| Diabetes | HbA1c, complications | Moderate |
| Multiple Sclerosis | EDSS, relapse rate | Emerging |

## Limitations

| Limitation | Impact | Mitigation |
|------------|--------|------------|
| Data Quality | Prediction accuracy | Data cleaning, imputation |
| Rare Events | Underrepresentation | Transfer learning |
| Novel Treatments | No historical data | Mechanism-based models |
| Individual Variation | Uncertainty | Probabilistic models |

## Special Considerations

1. **Privacy**: Ensure de-identification and consent
2. **Bias**: Validate across demographic groups
3. **Interpretability**: Explain predictions to clinicians
4. **Updating**: Continuously refine with new data
5. **Uncertainty**: Always quantify prediction confidence

## Future Directions

| Direction | Timeline | Impact |
|-----------|----------|--------|
| Real-time Twins | 3-5 years | Continuous monitoring |
| Federated Twins | 2-3 years | Multi-site collaboration |
| Causal Twins | Ongoing | True treatment effects |
| Regulatory Integration | 5-7 years | Standard practice |

## Author

AI Group - Biomedical AI Platform


<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->

---
Source attribution: FreedomIntelligence
Original project: https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 FridrichMethod

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---

NOTE ON BUNDLED CONTENT

This repository aggregates skills from multiple upstream projects (see the
README for the source list). Each `skills/<name>/` directory may carry its
own license inherited from its upstream source. The MIT license above
applies to this repository's curation and the scripts/workflows in `/`,
`/scripts/`, and `/.github/` — not to the upstream skill content itself.
Consult the upstream repository linked in the README and any LICENSE
file inside a skill directory before reusing skill content commercially.



# Mega AI Hub resource metadata

Creator / publisher: FreedomIntelligence
Original project: https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills
Attribution basis: Exact package in biomedical source index and publisher source table

Fields of work: Data & Analytics, Healthcare & Life Sciences, Product Management
Roles: Business Intelligence Analyst, Clinical Research, Data Scientist, Health Informatics, Product Manager
Specialties: API, Database
Tools: Python
Country applicability: United States
Classification basis: Source catalog labels
Instruction SHA-256: a79fdb177a3e36cbf18a4d36501fe2ae422a8b9a7fd1af7dafd0bf8da0d22ad3
Metadata reviewed: 2026-10-27
This metadata supersedes earlier Mega AI Hub catalog attribution. Original instruction and supporting files are preserved.
