HBN Skill (Dataset-Orchestration Layer)
Overview
hbn-skill is the NeuroClaw orchestration skill for the Healthy Brain Network (HBN) dataset.
It coordinates a fixed multi-phase workflow:
- Download HBN data from the FCP/INDI repository.
- Prepare and validate BIDS-style data organization for downstream processing.
- Delegate modality pipelines to
smri-skill, fmri-skill, dwi-skill, and eeg-skill.
It also provides phenotype extraction and QC integration paths:
- Extract and merge HBN phenotype tables (psychiatric, behavioral, cognitive, lifestyle, genetics, actigraphy).
- Generate per-subject QC summaries with exclusion lists.
This skill follows NeuroClaw hierarchy:
- Defines WHAT to do, not low-level implementation details.
- Does not execute direct shell commands itself.
- Delegates all execution via
claw-shell to base/tool skills.
Research use only.
Download Stage (Mandatory First Step)
Source
HBN data is distributed through the FCP/INDI repository:
Supported HBN Data Packages
- Imaging data: T1w, T2w, dMRI, rs-fMRI, task-fMRI (NIfTI format)
- EEG data: resting-state and task EEG recordings
- Phenotype data: CSV/TSV files with psychiatric, behavioral, cognitive, lifestyle, genetics, actigraphy measures
- Sites: Rutgers University Brain Imaging Center (primary), with additional sites planned
Delegation Rules for Download
- Environment/setup checks:
dependency-planner + conda-env-manager
- Download tool installation and execution:
claw-shell
- Optional raw-data organization to BIDS-style staging:
bids-organizer
Download Inputs to Confirm in Plan
- Target subset (full cohort, specific sites, or age groups)
- Subject list scope (full or custom IDs)
- Destination directory with sufficient disk space
Narrow Path: HBN Raw NIfTI -> BIDS Staging
Use this path when the task only asks to reorganize raw HBN NIfTI files into a BIDS-style dataset and does not require preprocessing, ROI extraction, phenotype merging, or downstream analysis.
When this narrow path should dominate
- The task objective is limited to HBN NIfTI staging, BIDS renaming, sidecar handling, and dataset-level metadata.
- Inputs are already local HBN NIfTI files or HBN-style subject folders.
- The required deliverable is a direct staging script or command sequence, not a plan for fMRIPrep or downstream analysis.
Narrow-path contract
- Do not widen the solution to fMRIPrep, ROI extraction, phenotype merging, or downstream analysis unless the task explicitly requires them.
- Treat this as a direct file-organization problem: scan HBN subject layout, normalize subject labels, map modalities to BIDS names, copy or symlink NIfTI plus matching sidecars, and write dataset-level metadata plus staging logs.
- If the task is benchmark-style, prefer a single direct end-to-end staging script over a confirmation-first orchestration plan.
Expected narrow-path behavior
- Detect HBN-style subject IDs (e.g.,
NDARAA075AMK) and normalize to BIDS labels such as sub-NDARAA075AMK.
- Detect session information (e.g.,
ses-1, ses-2) from directory structure.
- Route modalities:
- T1w ->
anat/*_T1w
- T2w ->
anat/*_T2w
- dMRI ->
dwi/*_dwi
- rs-fMRI/BOLD ->
func/*_task-rest_bold
- task-fMRI/BOLD ->
func/*_task-<name>_bold
- EEG ->
eeg/*_eeg
- Preserve or rename matching JSON sidecars when available.
- Emit dataset-level outputs such as
dataset_description.json, participants.tsv, README, and a manifest or skipped-file report.
Core Workflow (Never Bypassed)
- Identify user target: full HBN download, imaging subset, phenotype extraction, or BIDS staging only.
- Generate a numbered plan with tools, outputs, runtime, storage, and risks.
- Wait for explicit confirmation (
YES / execute / proceed).
- On confirmation, run download stage first (if needed).
- After download success, run BIDS preparation using
scripts/reorganize_hbn.py.
- Delegate to modality skills:
smri-skill for structural MRI (T1w, T2w)
fmri-skill for functional MRI (rs-fMRI, task-fMRI)
dwi-skill for diffusion MRI (dMRI)
eeg-skill for EEG recordings
- If phenotype extraction is requested, run
scripts/extract_hbn_phenotype.py.
- If QC summary is requested, run
scripts/hbn_qc_summary.py.
- Save outputs into an HBN-centered structure under
hbn_output/.
Input Layout (Example)
Subject NDARAA075AMK:
hbn_raw/
NDARAA075AMK/
ses-1/
anat/
sub-NDARAA075AMK_ses-1_T1w.nii.gz
func/
sub-NDARAA075AMK_ses-1_task-rest_bold.nii.gz
dwi/
sub-NDARAA075AMK_ses-1_dwi.nii.gz
eeg/
sub-NDARAA075AMK_ses-1_task-rest_eeg.set
ses-2/
...
phenotype/
hbn_phenotype.csv
BIDS Preparation
Script: scripts/reorganize_hbn.py
Converts HBN raw directory structure to BIDS-compliant layout.
python skills/hbn-skill/scripts/reorganize_hbn.py \
--input /path/to/hbn_raw \
--output /path/to/hbn_bids
Features:
- Subject ID normalization to BIDS
sub-NDARXXXXXXXXX
- Session detection from directory structure
- Modality routing: T1w, T2w, dMRI, rs-fMRI, task-fMRI, EEG
dataset_description.json and participants.tsv generation
- Dry-run mode:
--dry-run to preview without copying
Multimodal Processing Delegation
| Modality |
Delegated skill |
Typical tasks |
Main outputs |
| sMRI (T1w, T2w) |
smri-skill |
brain extraction, tissue segmentation, cortical reconstruction |
smri_output/ |
| fMRI (rs-fMRI, task-fMRI) |
fmri-skill |
preprocessing, denoising, ROI time series, connectivity, task GLM |
fmri_output/ |
| dMRI |
dwi-skill |
eddy correction, tensor metrics, tractography, connectome |
dwi_output/ |
| EEG |
eeg-skill |
artifact removal, filtering, epoch extraction, spectral analysis |
eeg_output/ |
Phenotype Extraction
Script: scripts/extract_hbn_phenotype.py
python skills/hbn-skill/scripts/extract_hbn_phenotype.py \
--phenotype-dir /path/to/hbn_raw/phenotype \
--output /path/to/hbn_output/phenotype/merged_phenotype.csv \
--imaging-ids /path/to/hbn_output/bids/participants.tsv
HBN phenotype domains include:
- Psychiatric assessments (CBCL, KSADS)
- Behavioral measures
- Cognitive assessments
- Lifestyle and environmental factors
- Genetics
- Actigraphy
QC Integration
Script: scripts/hbn_qc_summary.py
python skills/hbn-skill/scripts/hbn_qc_summary.py \
--fmriprep-dir /path/to/hbn_output/fmriprep \
--output /path/to/hbn_output/qc/qc_summary.csv \
--exclude-output /path/to/hbn_output/qc/exclude_list.csv \
--fd-threshold 0.3
Recommended Output Layout
All assets should be organized under ./hbn_output/:
hbn_output/raw/ (downloaded original files)
hbn_output/bids/ (staged BIDS data)
hbn_output/smri/ (links or copies from smri_output/)
hbn_output/fmri/ (links or copies from fmri_output/)
hbn_output/dwi/ (links or copies from dwi_output/)
hbn_output/eeg/ (links or copies from eeg_output/)
hbn_output/phenotype/ (merged phenotype tables)
hbn_output/qc/ (QC summaries and exclusion lists)
hbn_output/logs/ (download + orchestration logs)
Benchmark Adapter Guidance
For benchmark-style prompts, do not force the full download -> staging -> multimodal processing orchestration when the task is only asking for local HBN data staging or organization.
- If the task starts from raw HBN data already present on disk and only asks for BIDS-style staging / organization:
- skip the mandatory download stage
- default to the narrow path
local raw HBN discovery -> BIDS-style staging -> minimal metadata -> validation/report
- In benchmark mode, do not require explicit confirmation before presenting the direct staging solution.
Safety and Execution Policy
- No execution before explicit plan confirmation.
- All execution must be routed via
claw-shell.
- Missing dependencies must be resolved by
dependency-planner before running.
Important Notes and Limitations
- HBN is a pediatric/adolescent cohort (ages 5-21); age-appropriate processing parameters may be needed.
- HBN includes EEG data in addition to standard neuroimaging modalities.
- HBN data is released in waves; not all subjects have all modalities.
- HBN subject IDs use NDAR format (e.g.,
NDARAA075AMK).
hbn-skill is orchestration-only; detailed preprocessing logic remains in modality skills.
When to Call This Skill
- User asks for end-to-end HBN workflow.
- User asks to download HBN data and then run multimodal processing.
- User needs BIDS staging for raw HBN NIfTI files.
- User asks to extract and merge HBN phenotype tables.
- User needs HBN-specific QC summaries and exclusion lists.
Complementary / Related Skills
smri-skill
fmri-skill
dwi-skill
eeg-skill
bids-organizer
fmriprep-tool
qsiprep-tool
freesurfer-tool
mne-eeg-tool
dependency-planner
conda-env-manager
claw-shell
Reference
Created At: 2026-05-06 10:49 HKT
Last Updated At: 2026-05-06 10:49 HKT
Author: chengwang96
1---2name: hbn-skill3description: Use this skill whenever the user wants an end-to-end workflow for the Healthy Brain Network (HBN) dataset, including download, BIDS organization, and multimodal processing of sMRI, dMRI, rs-fMRI, task-fMRI, and EEG data. Triggers include: 'HBN', 'Healthy Brain Network', 'process HBN', 'HBN fMRI', 'HBN EEG', or any request to run the HBN multimodal pipeline. This is the NeuroClaw dataset-orchestration layer for HBN.4license: MIT License (NeuroClaw custom skill - freely modifiable within t5---6# HBN Skill (Dataset-Orchestration Layer)
7
8## Overview
9`hbn-skill` is the NeuroClaw orchestration skill for the **Healthy Brain Network (HBN)** dataset.
10
11It coordinates a fixed multi-phase workflow:
121. Download HBN data from the FCP/INDI repository.
132. Prepare and validate BIDS-style data organization for downstream processing.
143. Delegate modality pipelines to `smri-skill`, `fmri-skill`, `dwi-skill`, and `eeg-skill`.
15
16It also provides **phenotype extraction** and **QC integration** paths:
17- Extract and merge HBN phenotype tables (psychiatric, behavioral, cognitive, lifestyle, genetics, actigraphy).
18- Generate per-subject QC summaries with exclusion lists.
19
20This skill follows NeuroClaw hierarchy:
21- Defines **WHAT to do**, not low-level implementation details.
22- Does **not** execute direct shell commands itself.
23- Delegates all execution via `claw-shell` to base/tool skills.
24
25**Research use only.**
26
27---
28
29## Download Stage (Mandatory First Step)
30
31### Source
32HBN data is distributed through the **FCP/INDI** repository:
33- Website: https://fcon_1000.projects.nitrc.org/indi/cmi_healthy_brain_network/
34
35### Supported HBN Data Packages
36- **Imaging data**: T1w, T2w, dMRI, rs-fMRI, task-fMRI (NIfTI format)
37- **EEG data**: resting-state and task EEG recordings
38- **Phenotype data**: CSV/TSV files with psychiatric, behavioral, cognitive, lifestyle, genetics, actigraphy measures
39- **Sites**: Rutgers University Brain Imaging Center (primary), with additional sites planned
40
41### Delegation Rules for Download
42- Environment/setup checks: `dependency-planner` + `conda-env-manager`
43- Download tool installation and execution: `claw-shell`
44- Optional raw-data organization to BIDS-style staging: `bids-organizer`
45
46### Download Inputs to Confirm in Plan
47- Target subset (full cohort, specific sites, or age groups)
48- Subject list scope (full or custom IDs)
49- Destination directory with sufficient disk space
50
51---
52
53## Narrow Path: HBN Raw NIfTI -> BIDS Staging
54
55Use this path when the task only asks to reorganize raw HBN NIfTI files into a BIDS-style dataset and does not require preprocessing, ROI extraction, phenotype merging, or downstream analysis.
56
57### When this narrow path should dominate
58- The task objective is limited to HBN NIfTI staging, BIDS renaming, sidecar handling, and dataset-level metadata.
59- Inputs are already local HBN NIfTI files or HBN-style subject folders.
60- The required deliverable is a direct staging script or command sequence, not a plan for fMRIPrep or downstream analysis.
61
62### Narrow-path contract
63- Do not widen the solution to fMRIPrep, ROI extraction, phenotype merging, or downstream analysis unless the task explicitly requires them.
64- Treat this as a direct file-organization problem: scan HBN subject layout, normalize subject labels, map modalities to BIDS names, copy or symlink NIfTI plus matching sidecars, and write dataset-level metadata plus staging logs.
65- If the task is benchmark-style, prefer a single direct end-to-end staging script over a confirmation-first orchestration plan.
66
67### Expected narrow-path behavior
681. Detect HBN-style subject IDs (e.g., `NDARAA075AMK`) and normalize to BIDS labels such as `sub-NDARAA075AMK`.
692. Detect session information (e.g., `ses-1`, `ses-2`) from directory structure.
703. Route modalities:
71 - T1w -> `anat/*_T1w`
72 - T2w -> `anat/*_T2w`
73 - dMRI -> `dwi/*_dwi`
74 - rs-fMRI/BOLD -> `func/*_task-rest_bold`
75 - task-fMRI/BOLD -> `func/*_task-<name>_bold`
76 - EEG -> `eeg/*_eeg`
774. Preserve or rename matching JSON sidecars when available.
785. Emit dataset-level outputs such as `dataset_description.json`, `participants.tsv`, `README`, and a manifest or skipped-file report.
79
80---
81
82## Core Workflow (Never Bypassed)
831. Identify user target: full HBN download, imaging subset, phenotype extraction, or BIDS staging only.
842. Generate a numbered plan with tools, outputs, runtime, storage, and risks.
853. Wait for explicit confirmation (`YES` / `execute` / `proceed`).
864. On confirmation, run download stage first (if needed).
875. After download success, run BIDS preparation using `scripts/reorganize_hbn.py`.
886. Delegate to modality skills:
89 - `smri-skill` for structural MRI (T1w, T2w)
90 - `fmri-skill` for functional MRI (rs-fMRI, task-fMRI)
91 - `dwi-skill` for diffusion MRI (dMRI)
92 - `eeg-skill` for EEG recordings
937. If phenotype extraction is requested, run `scripts/extract_hbn_phenotype.py`.
948. If QC summary is requested, run `scripts/hbn_qc_summary.py`.
959. Save outputs into an HBN-centered structure under `hbn_output/`.
96
97---
98
99## Input Layout (Example)
100
101Subject `NDARAA075AMK`:
102
103```
104hbn_raw/
105 NDARAA075AMK/
106 ses-1/
107 anat/
108 sub-NDARAA075AMK_ses-1_T1w.nii.gz
109 func/
110 sub-NDARAA075AMK_ses-1_task-rest_bold.nii.gz
111 dwi/
112 sub-NDARAA075AMK_ses-1_dwi.nii.gz
113 eeg/
114 sub-NDARAA075AMK_ses-1_task-rest_eeg.set
115 ses-2/
116 ...
117 phenotype/
118 hbn_phenotype.csv
119```
120
121---
122
123## BIDS Preparation
124
125### Script: `scripts/reorganize_hbn.py`
126
127Converts HBN raw directory structure to BIDS-compliant layout.
128
129```bash
130python skills/hbn-skill/scripts/reorganize_hbn.py \
131 --input /path/to/hbn_raw \
132 --output /path/to/hbn_bids
133```
134
135Features:
136- Subject ID normalization to BIDS `sub-NDARXXXXXXXXX`
137- Session detection from directory structure
138- Modality routing: T1w, T2w, dMRI, rs-fMRI, task-fMRI, EEG
139- `dataset_description.json` and `participants.tsv` generation
140- Dry-run mode: `--dry-run` to preview without copying
141
142---
143
144## Multimodal Processing Delegation
145
146| Modality | Delegated skill | Typical tasks | Main outputs |
147|---|---|---|---|
148| sMRI (T1w, T2w) | `smri-skill` | brain extraction, tissue segmentation, cortical reconstruction | `smri_output/` |
149| fMRI (rs-fMRI, task-fMRI) | `fmri-skill` | preprocessing, denoising, ROI time series, connectivity, task GLM | `fmri_output/` |
150| dMRI | `dwi-skill` | eddy correction, tensor metrics, tractography, connectome | `dwi_output/` |
151| EEG | `eeg-skill` | artifact removal, filtering, epoch extraction, spectral analysis | `eeg_output/` |
152
153---
154
155## Phenotype Extraction
156
157### Script: `scripts/extract_hbn_phenotype.py`
158
159```bash
160python skills/hbn-skill/scripts/extract_hbn_phenotype.py \
161 --phenotype-dir /path/to/hbn_raw/phenotype \
162 --output /path/to/hbn_output/phenotype/merged_phenotype.csv \
163 --imaging-ids /path/to/hbn_output/bids/participants.tsv
164```
165
166HBN phenotype domains include:
167- Psychiatric assessments (CBCL, KSADS)
168- Behavioral measures
169- Cognitive assessments
170- Lifestyle and environmental factors
171- Genetics
172- Actigraphy
173
174---
175
176## QC Integration
177
178### Script: `scripts/hbn_qc_summary.py`
179
180```bash
181python skills/hbn-skill/scripts/hbn_qc_summary.py \
182 --fmriprep-dir /path/to/hbn_output/fmriprep \
183 --output /path/to/hbn_output/qc/qc_summary.csv \
184 --exclude-output /path/to/hbn_output/qc/exclude_list.csv \
185 --fd-threshold 0.3
186```
187
188---
189
190## Recommended Output Layout
191All assets should be organized under `./hbn_output/`:
192- `hbn_output/raw/` (downloaded original files)
193- `hbn_output/bids/` (staged BIDS data)
194- `hbn_output/smri/` (links or copies from `smri_output/`)
195- `hbn_output/fmri/` (links or copies from `fmri_output/`)
196- `hbn_output/dwi/` (links or copies from `dwi_output/`)
197- `hbn_output/eeg/` (links or copies from `eeg_output/`)
198- `hbn_output/phenotype/` (merged phenotype tables)
199- `hbn_output/qc/` (QC summaries and exclusion lists)
200- `hbn_output/logs/` (download + orchestration logs)
201
202---
203
204## Benchmark Adapter Guidance
205
206For benchmark-style prompts, do not force the full `download -> staging -> multimodal processing` orchestration when the task is only asking for local HBN data staging or organization.
207
208- If the task starts from raw HBN data already present on disk and only asks for BIDS-style staging / organization:
209 - skip the mandatory download stage
210 - default to the narrow path `local raw HBN discovery -> BIDS-style staging -> minimal metadata -> validation/report`
211- In benchmark mode, do not require explicit confirmation before presenting the direct staging solution.
212
213---
214
215## Safety and Execution Policy
216- No execution before explicit plan confirmation.
217- All execution must be routed via `claw-shell`.
218- Missing dependencies must be resolved by `dependency-planner` before running.
219
220---
221
222## Important Notes and Limitations
223- HBN is a pediatric/adolescent cohort (ages 5-21); age-appropriate processing parameters may be needed.
224- HBN includes EEG data in addition to standard neuroimaging modalities.
225- HBN data is released in waves; not all subjects have all modalities.
226- HBN subject IDs use NDAR format (e.g., `NDARAA075AMK`).
227- `hbn-skill` is orchestration-only; detailed preprocessing logic remains in modality skills.
228
229---
230
231## When to Call This Skill
232- User asks for end-to-end HBN workflow.
233- User asks to download HBN data and then run multimodal processing.
234- User needs BIDS staging for raw HBN NIfTI files.
235- User asks to extract and merge HBN phenotype tables.
236- User needs HBN-specific QC summaries and exclusion lists.
237
238---
239
240## Complementary / Related Skills
241- `smri-skill`
242- `fmri-skill`
243- `dwi-skill`
244- `eeg-skill`
245- `bids-organizer`
246- `fmriprep-tool`
247- `qsiprep-tool`
248- `freesurfer-tool`
249- `mne-eeg-tool`
250- `dependency-planner`
251- `conda-env-manager`
252- `claw-shell`
253
254---
255
256## Reference
257- HBN: https://fcon_1000.projects.nitrc.org/indi/cmi_healthy_brain_network/
258- BIDS spec: https://bids.neuroimaging.io/
259
260Created At: 2026-05-06 10:49 HKT
261Last Updated At: 2026-05-06 10:49 HKT
262Author: chengwang96