equiflow

equiflow is a skill for Claude Code, Codex from hannesill/m4. It costs 52 tokens per session (850 once invoked), scanned A, original, MIT.

A tool for drawing cohort-selection diagrams and checking whether patient groups are excluded unevenly. A cohort is the group of people included in a study; SMD is a statistic used to compare groups.

In plain words
What is it for?
Use it to document patient inclusion and exclusion, track variables such as age, race, insurance, and mortality, and measure selection bias in clinical machine-learning or research cohorts.
Why use it?
It helps reveal when the rules used to build a medical-research dataset leave out more people from certain demographic or socioeconomic groups.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to document patient inclusion and exclusion, track variables such as…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hannesill/m4/equiflow
View source ↗ hannesill/m4
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add hannesill/m4 --skill equiflow
Clone the repo
git clone --depth 1 https://github.com/hannesill/m4

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for equiflow

README.md
[![agentmods](https://agentmods.dev/badge/skills/hannesill/m4/equiflow.svg)](https://agentmods.dev/skills/hannesill/m4/equiflow)
Your own site
<a href="https://agentmods.dev/skills/hannesill/m4/equiflow"><img src="https://agentmods.dev/badge/skills/hannesill/m4/equiflow.svg" alt="Measured on agentmods" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 850 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.00850
Opus 5 $0.00026 $0.00425
Sonnet 5 $0.00010 $0.00170
Haiku 4.5 $0.00005 $0.00085

Measured 7d ago against content hash e5200bd8c04d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

equiflow scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/cohort_flow.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/m4/skills/clinical/equiflow/SKILL.md · 104 lines

How it starts

The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.

EquiFlow - Equity-Focused Cohort Flow Diagrams

Visualize and quantify selection bias in clinical ML/research cohorts. Based on Ellen et al. (2024) J Biomed Inform.

When to Use This Skill

  • Building patient cohorts from MIMIC-IV or eICU
  • Documenting inclusion/exclusion criteria with CONSORT-style diagrams
  • Detecting disproportionate exclusion of vulnerable groups
  • Quantifying selection bias via Standardized Mean Difference (SMD)

Default Equity Variables

When no variables are specified, CohortFlow automatically tracks:

Category Variables Column Aliases
Demographics gender gender, sex
race race, ethnicity
age anchor_age, age, admission_age
Socioeconomic insurance insurance, insurance_type, payer
language language, primary_language
marital_status marital_status, marital
Clinical los los, length_of_stay, icu_los
Outcome mortality hospital_expire_flag, mortality, death

SMD Interpretation

| |SMD| | Interpretation | Action | |-------|----------------|--------| | < 0.1 | Negligible | OK | | 0.1-0.2 | Small | Monitor | | > 0.2 | Meaningful | Investigate | | > 0.5 | Large | Serious concern |

See references/smd_interpretation.md for detailed guidance.

Critical Implementation Notes

  1. Auto-detection: CohortFlow scans DataFrame columns for known aliases. Override with use_defaults=False if you want full control.

  2. SMD > 0.2 is the default threshold for flagging potential bias. This follows established covariate balance literature.

  3. Missing data: Exclusion steps that remove patients with missing values can introduce systematic bias. Always check SMD after such steps.

Example Queries

Full workflow with MIMIC-IV

from cohort_flow import CohortFlow

# Step 1: Query MIMIC-IV
query = """
SELECT
    p.subject_id, p.gender, p.anchor_age,
    a.race, a.insurance, a.language, a.marital_status,
    a.hospital_expire_flag,
    i.los
FROM mimiciv_hosp.patients p
JOIN mimiciv_hosp.admissions a USING (subject_id)
JOIN mimiciv_icu.icustays i ON a.hadm_id = i.hadm_id
"""
df = execute_query(query)

# Step 2: Build cohort with equity tracking
cf = CohortFlow(df)  # Auto-detects equity variables

cf.exclude(df['anchor_age'] >= 18, "Age < 18", "Adults")
cf.exclude(df['los'] >= 24, "ICU < 24h", "ICU >= 24h")
cf.exclude(df['anchor_age'] <= 90, "Age > 90", "Age 18-90")

# Step 3: Check for bias
print(cf.check_bias())  # Flags variables with SMD > 0.2

# Step 4: Generate diagram
cf.plot("sepsis_cohort_flow")

Read the full file on GitHub · 104 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 104 lines · 52 tokens per session scan A e5200bd8c04d

Subscribe to this mod's changes

equiflow is a skill published in the GitHub repository hannesill/m4 (43 stars, last pushed 1mo ago), licensed MIT. It adds 52 tokens to every session and 850 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

arbor-agent-orchestrator

Top-level controller for recreating the open-source AutoResearch workflow as a suite of skills. Use when the user asks to run, emulate, extract, validate, or refine Arbor/AutoResearch behavior, especially when a coordinator must load phase skills for setup, ideation, executors, merge evaluation, novelty search…

RUC-NLPIR/Arbor · 77 tokens

dfam-check

Measure mesh files against Design for Additive Manufacturing (DfAM) rules and report printability findings per process (FDM, SLS, SLA/DLP, metal PBF, MJF). Use when the user asks whether a part is printable, wants overhang/wall-thickness/support analysis of an .stl, .obj, .ply, or .3mf mesh, wants a build-orientation…

earthtojake/text-to-cad · 111 tokens

tooluniverse-gene-enrichment

Gene-set enrichment analysis — GO (Biological Process, Molecular Function, Cellular Component), KEGG, Reactome pathway enrichment via clusterProfiler, gseapy, ORA, GSEA. Use for interpreting DEG lists, screen hit lists, or any gene-list-to-pathways query. Includes simplify-cutoff handling and union-vs-total…

mims-harvard/ToolUniverse · 82 tokens

tooluniverse-phylogenetics

Phylogenetic analysis — de novo multiple sequence alignment (Clustal Omega/MUSCLE/MAFFT via EBImsaalign) and neighbour-joining/UPGMA tree building (EBIbuildphylogenetictree) from your own sequences, plus tree analysis, treeness, saturation (PhyKIT), parsimony-informative sites, alignment gap analysis, DVMC…

mims-harvard/ToolUniverse · 155 tokens

tooluniverse-pharmacogenomics

Pharmacogenomics (PGx) research — drug-gene interactions (CPIC, PharmGKB), CPIC dosing guidelines, variant-drug-response associations, ethnic-allele-frequency considerations, and metabolizer-status scoring. Use for PGx-informed dosing recommendations, CYP/HLA pharmacogenomic allele interpretation, and…

mims-harvard/ToolUniverse · 80 tokens

tooluniverse-population-genetics

Population genetics analysis — allele frequencies (gnomAD, 1000 Genomes), Hardy-Weinberg equilibrium testing, Fst between populations, GWAS associations, evolutionary constraint scores. Use for cross-population variant comparison, ancestry-aware allele frequency lookups, and population-level evolutionary analysis.

mims-harvard/ToolUniverse · 66 tokens