Run Models Skill (Model Entry Layer)

SkillAI & models

Use this skill whenever the user wants to run phenotype-prediction models, browse model cards, map model inputs/outputs, or choose an execution route for fMRI/sMRI based models. This is a model-entry orchestration skill: it routes requests to model-specific docs and delegates preprocessing to modality skills.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Run Models Skill (Model Entry Layer) skill

What this skill tells your AI

The instructions your AI receives, as published by cuhk-aim-group/neurodiscovery in skills/run_models/SKILL.md and read by ahel’s review.

Overview

run_models is the NeuroClaw entry skill for model-level inference workflows.

This skill is responsible for:

  • Maintaining a model registry (name, paper, source code, input/output, doc file path)
  • Selecting the correct model skill under skills/<model-name>/SKILL.md
  • Coordinating required data preparation before model execution
  • Delegating modality preprocessing to fmri-skill and smri-skill

It supports both:

  • deep learning model routes for phenotype prediction
  • non-deep-learning statistical / unsupervised / classical machine-learning routes such as first-level and second-level task-fMRI GLM, resting-state ICA, resting-state DictLearning, disease classification with SVM, disease classification with SpaceNet, brain parcellation with K-means, brain parcellation with Hierarchical clustering, temporal filtering, and detrending

This skill does not hardcode detailed install/run commands for each model. Those details are stored in model-specific markdown files.

Research use only.


Core Workflow (Never Bypassed)

  1. Identify requested model and task (classification/regression phenotype prediction).
  2. Locate the corresponding model skill under skills/<model-name>/SKILL.md.
  3. Verify required inputs (ROI features, optional sMRI features).
  4. If inputs are not ready, delegate preprocessing to modality skills:
    • fmri-skill for ROI extraction from fMRI
    • smri-skill when model additionally requires structural features
  5. Generate a numbered execution plan and wait for explicit user confirmation (YES / execute / proceed).
  6. On confirmation, execute via claw-shell following model doc instructions.

Model Registry (Current)

ModelPaperCodeInputOutputModel Doc
BrainGNNLi et al., 2020, Braingnn: Interpretable brain graph neural network for fmri analysishttps://github.com/xxlya/BrainGNN_Pytorch/tree/mainfMRI ROI features (graph/node-level ROI representation)Phenotype prediction (classification/regression) + interpretable graph indicatorsskills/brain_gnn/SKILL.md
BNTKan et al., 2022, BrainNetworkTransformerhttps://github.com/Wayfear/BrainNetworkTransformerfMRI ROI FC matrix (dense [N, N], no PyG)Phenotype prediction (classification/regression) + attention weights + DEC cluster assignmentsskills/bnt/SKILL.md
BrainNetCNNKawahara et al., 2017, BrainNetCNNhttps://github.com/jeremykawahara/brainnetcnnDense ROI connectivity matrix [N, N]Phenotype classification/regression with E2E, E2N, and N2G convolutionsskills/brainnetcnn/SKILL.md
FM-APPHe et al., 2024, FM-APP: Foundation model for any phenotype prediction via fMRI to sMRI knowledge transferhttps://github.com/ZhibinHe/FM-APPfMRI ROI features + sMRI featuresPhenotype prediction (any-phenotype setting)skills/fm_app/SKILL.md
NeuroStormNeuroClaw model entry for storm-related phenotype prediction workflowssee skills/neurostorm/SKILL.mdMulti-modal neuroimaging features as specified in the model docPhenotype prediction / downstream inference as specified in the model docskills/neurostorm/SKILL.md
GLMClassical first-level and second-level task-fMRI general linear modelNilearn / SPM-style implementation routePreprocessed task fMRI, events, optional confounds, and optional subject-level contrast maps for group inferenceTask activation contrasts, group z maps, and statistical inference outputsskills/glm/SKILL.md
ICAClassical resting-state network decomposition methodNilearn decomposition implementation routePreprocessed resting-state fMRI, optional mask, optional confoundsIntrinsic connectivity component maps, subject time series, optional connectomesskills/ica/SKILL.md
DictLearningClassical sparse resting-state network decomposition methodNilearn decomposition implementation routePreprocessed resting-state fMRI, optional mask, optional confoundsSparse component maps, subject time series, optional connectomesskills/dictlearning/SKILL.md
SpaceNetClassical voxel-wise disease classification method for neuroimagingNilearn decoding implementation routeAligned voxel maps, labels, optional covariates, optional maskPredicted labels, decision scores, CV metrics, coefficient mapsskills/spacenet/SKILL.md
K-meansClassical brain parcellation method for neuroimagingNilearn / clustering-based parcellation routePreprocessed feature maps or image lists, optional mask, requested parcel countParcel labels, cluster summaries, optional centroid outputsskills/kmeans/SKILL.md
HierarchicalClassical hierarchical brain parcellation method for neuroimagingNilearn / clustering-based parcellation routePreprocessed feature maps or image lists, optional mask, requested parcel countParcel labels, cluster summaries, optional dendrogram outputsskills/hierarchical/SKILL.md
FilteringClassical signal denoising method for neuroimaging time seriesNilearn / preprocessing routePreprocessed BOLD image or time series, TR, optional confounds, optional maskDenoised BOLD, cleaned time series, optional QC summariesskills/filtering/SKILL.md
DetrendingClassical signal denoising method for neuroimaging time seriesNilearn / preprocessing routePreprocessed BOLD image or time series, TR, optional confounds, optional maskCleaned BOLD, cleaned time series, optional QC summariesskills/detrending/SKILL.md
Statistical MLOLS, logistic/Ridge/Elastic Net, SVM/SVR, XGBoost, MixedLMNeuroClaw unified tabular trainerSubject-level tabular/ROI featuresFold-local predictions, inference, metricsskills/statistical-ml/SKILL.md
Subject SubtypingK-means, GMM, spectral, NMF, consensus, autoencoderNeuroClaw subtyping trainerSubject-level feature matrixSubtype labels, embeddings, stability metricsskills/subject-subtyping/SKILL.md
Survival ModelsCox, RSF, DeepSurv, XGBoost survivalNeuroClaw censor-aware trainerFeatures, duration, eventRisk scores, concordanceskills/survival-models/SKILL.md
Causal TreatmentMeta-learners, DR, causal forest, TARNet, DragonNetNeuroClaw cross-fitted causal trainerFeatures, treatment, outcomeCATE, treatment policy, policy valueskills/causal-treatment-models/SKILL.md
Temporal ModelsLSTM, GRU, TCN, TransformerNeuroClaw PyTorch trainerSubject sequencesClassification/regression predictionsskills/temporal-models/SKILL.md
Imaging GeneticsGWAS/PRS, PLS, CCAPLINK2 + NeuroClaw matrix trainerGenotype and imaging phenotypeAssociations and latent scoresskills/imaging-genetics-models/SKILL.md
CNN3DCompact residual 3D CNNNeuroClaw PyTorch trainerSubject volumesPredictions and checkpointsskills/cnn3d/SKILL.md
CPMConnectome Predictive ModelingNeuroClaw CPM trainerFC matrices/vectors and labelsFold-local predictions and selected-network modelsskills/cpm/SKILL.md
KG Link PredictionComplEx, R-GCN, GraphSAGE, GATNeuroOracle/PyGKnowledge-graph triplesTriple scores and embeddingsskills/kg-link-prediction/SKILL.md

Scientific Workflow Registry

Workflows define a scientific experiment and delegate model fitting to one or more canonical model skills. They do not own duplicate model implementations.

WorkflowDelegated models/toolsOutputWorkflow Doc
Neuroimaging DecodingGLM, Statistical ML, Nilearn SearchLightpredictions, ROI statistics, score mapsskills/neuroimaging-decoding/SKILL.md
Connectome DiscoveryCPM or graph models, map similarity, brain visualizationsignificant network maps and ranked targetsskills/connectome-discovery/SKILL.md
Brain-Age ModelingStatistical ML or CNN3D plus fold-local correctionpredicted age and Brain-PADskills/brain-age-modeling/SKILL.md

Cross-Cutting Tools (Apply Across Models)

These are not models. They are horizontal layers that any model in the registry above can opt into without changing model code.

ToolPurposeWhen to invokeTool Doc
harmonization-toolRemove site/scanner/batch effects from features before model training; supports ComBat / ComBat-GAM / CovBat / site-as-covariate; ships site-stratified and leave-site-out splitters; required for honest mega-analysis across multi-site cohortsAny multi-site or multi-dataset run (ABIDE, ADHD-200, ABCD, multi-cohort pooling); user mentions ComBat / harmonize / site effect / cross-site / mega-analysisskills/harmonization-tool/SKILL.md

Insertion point: between dataset-skill output (feature matrix + meta) and model-skill input. Models read harmonized features identically to raw features.

Citation Notes

  • BrainGNN:
    • Li X, Zhou Y, Dvornek N, Zhang M, Gao S, Zhuang J, Scheinost D, Staib L, Ventola P, Duncan J. 2020.
  • BNT:
    • Kan X, Dai W, Cui H, Zhang Z, Guo Y, He L. 2022. BrainNetworkTransformer. NeurIPS.
  • BrainNetCNN:
    • Kawahara J, Brown CJ, Miller SP, et al. 2017. BrainNetCNN. NeuroImage.
  • FM-APP:
    • He Z, Li W, Liu Y, et al. FM-APP. IEEE TMI, 2024, 44(10): 4010-4022.
  • NeuroStorm:
    • See skills/neurostorm/SKILL.md for the current model card, citation, and execution details.
  • GLM:
    • Classical first-level and second-level general linear model for task-evoked activation analysis and group-level inference; see skills/glm/SKILL.md.
  • ICA:
    • Classical resting-state network decomposition route based on independent component analysis; see skills/ica/SKILL.md.
  • DictLearning:
    • Classical sparse resting-state network decomposition route; see skills/dictlearning/SKILL.md.
  • Statistical ML:
    • Canonical ROI/tabular route for logistic regression, SVM/SVR, Ridge, Elastic Net, XGBoost, OLS, and mixed-effects models.
  • SpaceNet:
    • Classical voxel-wise disease classification route with sparse coefficient maps; see skills/spacenet/SKILL.md.
  • K-means:
    • Classical brain parcellation route for fixed-K parcel discovery; see skills/kmeans/SKILL.md.
  • Hierarchical:
    • Classical brain parcellation route for multi-scale parcel discovery; see skills/hierarchical/SKILL.md.
  • Filtering:
    • Classical signal denoising route for temporal filtering; see skills/filtering/SKILL.md.
  • Detrending:
    • Classical signal denoising route for temporal drift removal; see skills/detrending/SKILL.md.

Harness-Aware Model Registration (Declarative + Testing + Drift Detection)

Model Specification Format (Extended)

Every model integrated into run_models must include a model specification file in JSON format alongside its Markdown documentation:

File: skills/{model_name}/{model_name}_spec.json

{
  "model_name": "brain_gnn",
  "version": "1.0.0",
  "paper": "Li et al., 2020",
  "code_repo": "https://github.com/xxlya/BrainGNN_Pytorch",
  "required_dependencies": {
    "torch": ">=1.9.0,<2.1.0",
    "numpy": ">=1.21.0",
    "scipy": ">=1.7.0",
    "networkx": ">=2.6.0"
  },
  "input_spec": {
    "modality": "fMRI",
    "format": "ROI time-series (N_nodes, T_timepoints)",
    "expected_shape": [116, null],
    "value_range": [-5.0, 5.0],
    "required_preprocessing": ["z-score normalization"]
  },
  "output_spec": {
    "type": "classification|regression",
    "classes": null,
    "value_range": null
  },
  "validation_checksums": {
    "weights_sha256": "abc123...",
    "test_data_sha256": "def456..."
  }
}

Test Suite Requirements

Every model must include an automated test suite covering:

  1. Input validation: verify input dimensions, data types, value ranges
  2. Determinism check: seed control + verify identical outputs with same seed (tolerance: 1e-6)
  3. Performance regression: compare inference speed and memory usage against baseline
  4. Output coherence: verify outputs lie within expected value range, no NaN/Inf values
  5. Backward compatibility: test model against previous version checksum (if available)

Test execution:

python -m pytest run_models/tests/test_{model_name}.py -v --harness-report

Output: run_models_test_report_{model_name}_{timestamp}.json with pass/fail status and metrics

Drift Detection Protocol

Monitor production/inference results for concept drift (distribution shift in data or model behavior):

Automated monitoring per 100 inferences:

  • Input distribution shift (KL divergence against reference data): flag if deviation > 0.1
  • Output distribution shift (prediction probability / regression output quantiles): flag if shift detected
  • Latency drift (average inference time): alert if >20% increase
  • Failure rate monitoring (predictions with NaN/Inf / out-of-range): flag if >1% failures

Logging output: run_models_drift_log.json (append-only, timestamped entries)

Example entry:

{
  "timestamp": "2026-04-05T14:32:00Z",
  "model": "brain_gnn",
  "inference_count": 100,
  "input_kl_divergence": 0.045,
  "output_mean_shift": 0.002,
  "latency_ms": 45.2,
  "failure_rate": 0.0,
  "status": "healthy"
}

Alert thresholds:

  • KL divergence > 0.1 → generate warning
  • Output shift > 5% std dev → investigation recommended
  • Latency drift > 20% → check computational resource bottleneck
  • Failure rate > 1% → stop inference, require manual review

Model Card Template (Minimum Required Metadata)

Each model must include a model card in skills/{model_name}/SKILL.md documenting:

## Model Card: {model_name}

### Model Details
- **Model name**: {name}
- **Version**: {X.Y.Z}
- **Date**: {YYYY-MM-DD}
- **Source repository**: {repo_url}
- **Paper**: {citation}

### Intended Use
- **Primary use case**: [e.g., fMRI-based phenotype classification]
- **Input modalities**: [fMRI, sMRI, etc.]
- **Supported tasks**: [classification, regression, interpretability]

### Known Limitations
- [e.g., "Trained on N subjects aged 18-65; generalization to pediatric/geriatric populations not validated"]
- [e.g., "Sensitive to head motion artifacts; recommend ICA-FIX preprocessing"]

### Validation Results
- **Test set performance**: [accuracy/AUC/RMSE with confidence intervals]
- **Cross-site validation**: [performance on held-out sites, if applicable]
- **Robustness checks**: [drift detection history, adversarial perturbation results]

### Dependencies & Versioning
- **Required libraries**: [see {model_name}_spec.json]
- **Hash (model weights)**: {SHA256}
- **Last verified**: {date}

Delegation Rules

BrainGNN Route

  • Required modality preprocessing: fmri-skill
  • Typical upstream outputs expected: ROI matrices/time-series converted to model-required feature tensors

BNT Route

  • Required modality preprocessing: fmri-skill
  • Typical upstream outputs expected: Same ROI .pt files as BrainGNN (shared data source under data/braingnn_input/)

BrainNetCNN Route

  • Required modality preprocessing: fmri-skill
  • Concrete model execution: skills/brainnetcnn/scripts/train_reference.py
  • Typical upstream outputs expected: Dense ROI connectivity matrices in the same .pt format and directory used by BNT

FM-APP Route

  • Required modality preprocessing: fmri-skill + smri-skill
  • Typical upstream outputs expected: fMRI ROI features plus structural MRI-derived features

NeuroStorm Route

  • Required modality preprocessing: follow the model doc in skills/neurostorm/SKILL.md
  • Typical upstream outputs expected: inputs and features specified by the NeuroStorm model card

GLM Route

  • Required modality preprocessing: fmri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • first-level GLM: preprocessed task fMRI, events, optional confounds, named contrasts
    • second-level GLM: subject-level contrast maps, group design matrix, group contrast definition

ICA Route

  • Required modality preprocessing: fmri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • preprocessed resting-state fMRI image list
    • optional mask and confounds
    • requested component count

DictLearning Route

  • Required modality preprocessing: fmri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • preprocessed resting-state fMRI image list
    • optional mask and confounds
    • requested component count

Statistical ML Route

  • Required modality preprocessing: fmri-skill and/or smri-skill
  • Concrete model execution: skills/statistical-ml/scripts/train_reference.py
  • Typical upstream outputs expected:
    • ROI/tabular feature matrix, target labels, optional covariates and groups

CNN3D Route

  • Required modality preprocessing: fmri-skill and/or smri-skill
  • Concrete model execution: skills/cnn3d/scripts/train_reference.py
  • Typical upstream outputs expected: aligned subject volume tensor and target

CPM Route

  • Required modality preprocessing: fmri-skill
  • Concrete model execution: skills/cpm/scripts/train_reference.py
  • Typical upstream outputs expected: aligned FC matrices/vectors and labels

SpaceNet Route

  • Required modality preprocessing: fmri-skill and/or smri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • aligned subject image list, diagnosis labels, mask image, optional covariates

K-means Route

  • Required modality preprocessing: fmri-skill and/or smri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • feature matrix or aligned image list for parcel discovery
    • optional mask
    • target parcel count

Hierarchical Route

  • Required modality preprocessing: fmri-skill and/or smri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • feature matrix or aligned image list for parcel discovery
    • optional mask or similarity structure
    • target parcel count

Filtering Route

  • Required modality preprocessing: fmri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • preprocessed BOLD image or extracted time series
    • TR, optional confounds, optional mask
    • optional frequency settings

Detrending Route

  • Required modality preprocessing: fmri-skill
  • Concrete model/tool execution: nilearn-tool
  • Typical upstream outputs expected:
    • preprocessed BOLD image or extracted time series
    • TR, optional confounds, optional mask
    • detrending request and optional standardization settings

Shared Execution Routing

  • Environment/dependency planning: dependency-planner + conda-env-manager
  • Actual model run command execution: claw-shell

Input and Output Contract (Entry-Level)

Inputs expected by this skill

  • Model selection (brain_gnn, bnt, fm_app, neurostorm, glm, ica, dictlearning, statistical-ml, spacenet, kmeans, hierarchical, filtering, detrending, cnn3d, cpm, subject-subtyping, survival-models, causal-treatment-models, temporal-models, imaging-genetics-models, or kg-link-prediction)
  • Data split / subject list
  • Phenotype target definition
  • Optional compute constraints (GPU/CPU, memory, batch size)

For GLM routes, the required task definition should be expressed as:

  • task name
  • events file
  • contrast(s) of interest
  • optional group-level analysis scope
  • whether the request is first-level GLM or second-level GLM
  • if second-level GLM: contrast map list and group design matrix

For ICA routes, the required decomposition definition should be expressed as:

  • resting-state image list or subject list
  • number of components
  • optional mask and confounds

For DictLearning routes, the required decomposition definition should be expressed as:

  • resting-state image list or subject list
  • number of components
  • optional mask and confounds

For Statistical ML routes, specify the target, task, model family, feature table, subject/group columns, split definition, and optional covariates.

For SpaceNet routes, the required classification definition should be expressed as:

  • diagnosis target / label column
  • feature type (voxel-wise)
  • subject list or split definition
  • optional covariates and mask

For K-means routes, the required parcellation definition should be expressed as:

  • image list or feature matrix
  • target parcel / cluster count
  • optional mask

For Hierarchical routes, the required parcellation definition should be expressed as:

  • image list or feature matrix
  • target parcel / cluster count
  • optional mask, similarity structure, or adjacency constraint

For Filtering routes, the required denoising definition should be expressed as:

  • input BOLD image or time series
  • TR
  • optional confounds, mask, and frequency settings

For Detrending routes, the required denoising definition should be expressed as:

  • input BOLD image or time series
  • TR
  • optional confounds, mask, and standardization settings

Outputs produced by this skill

  • A confirmed, numbered run plan
  • Pointers to the model-specific instruction file
  • Delegated preprocessing plan for required modalities
  • Structured output location recommendations

Recommended Output Layout

All model-running artifacts should be managed under ./run_models_output/:

  • run_models_output/preprocessed/
    • fmri/ (from fmri-skill)
    • smri/ (from smri-skill, if required)
  • run_models_output/brain_gnn/
  • run_models_output/bnt/
  • run_models_output/fm_app/
  • run_models_output/neurostorm/
  • run_models_output/glm/
  • run_models_output/ica/
  • run_models_output/dictlearning/
  • run_models_output/statistical_ml/
  • run_models_output/cnn3d/
  • run_models_output/cpm/
  • run_models_output/spacenet/
  • run_models_output/kmeans/
  • run_models_output/hierarchical/
  • run_models_output/filtering/
  • run_models_output/detrending/
  • run_models_output/logs/
  • run_models_output/reports/

Safety and Execution Policy

  • No execution before explicit user confirmation of the numbered plan.
  • All run/install actions must go through claw-shell.
  • If model skills are missing in skills/<model-name>/, stop and request or create them before execution.
  • Keep train/val/test split and target definition explicit to avoid leakage.

When to Call This Skill

  • User asks to run BrainGNN or FM-APP.
  • User asks to run BNT (BrainNetworkTransformer).
  • User asks to run BrainNetCNN or a connectome CNN.
  • User asks to run NeuroStorm.
  • User asks to run classical task activation analysis with GLM.
  • User asks to run group-level inference with second-level GLM.
  • User asks to perform resting-state network decomposition with ICA.
  • User asks to perform resting-state network decomposition with DictLearning.
  • User asks to perform ROI/tabular classification with SVM or another classical estimator; route through statistical-ml.
  • User asks to perform disease classification with SpaceNet.
  • User asks to perform brain parcellation with K-means.
  • User asks to perform brain parcellation with Hierarchical clustering.
  • User asks to perform signal denoising with filtering.
  • User asks to perform signal denoising with detrending.
  • User asks to train CNN3D or CPM.
  • User asks for subject subtyping, survival, causal-treatment, temporal, imaging-genetics, KG link-prediction, decoding, connectome-discovery, or brain-age workflows.
  • User asks which phenotype model to use for fMRI/sMRI ROI data.
  • User asks for a unified entry point to model introduction + run routing.

Complementary / Related Skills

  • fmri-skill
  • smri-skill
  • dependency-planner
  • conda-env-manager
  • claw-shell

Shortened here. Read the whole file on GitHub.

Signals

GitHub stars
85
Forks
4
Last commit
Sep 2026

ahel recommends instead

Advanced
Catalog kind
skill
Gateway key
run-models-cuhk-aim-group
Source
github.com/cuhk-aim-group/neurodiscovery