# ITC Modelling Agents: Evidence Synthesis Automation for R
> **🎯 Expert ITC Scientists** — 7 specialized agents with world-class methodology knowledge following NICE DSU guidance
>
> **📊 Complete Method Coverage** — Pairwise MA, NMA, MAIC, STC, and ML-NMR with 8 R packages supported
>
> **🔬 Deep Methodology Skills** — 6 progressive disclosure skills for evidence synthesis best practices
A comprehensive production-ready system combining **7 specialized ITC agents**, **2 multi-agent workflow orchestrators**, **6 methodology skills**, and complete coverage of indirect treatment comparison methods for [Claude Code](https://docs.anthropic.com/en/docs/claude-code).
## Overview
This plugin provides everything needed for rigorous indirect treatment comparison modelling in R:
- **7 Specialized Agents** - Domain experts covering method selection, analysis execution, and code review
- **6 Methodology Skills** - Deep knowledge packages following NICE DSU TSDs, Cochrane, and PRISMA guidelines
- **2 Workflow Orchestrators** - Multi-agent coordination for complete ITC analyses and code reviews
- **8 R Packages Supported** - `meta`, `metafor`, `bayesmeta`, `netmeta`, `gemtc`, `maicplus`, `stc`, `multinma`
- **Safe Code Amendment** - Original files never modified; corrections saved to subfolders
### Key Features
- **World-Class Expertise**: Agents embody best practices from NICE DSU TSDs, Cochrane Handbook, and leading HTA methodologists
- **Assumption Transparency**: Every analysis explicitly checks and documents methodological assumptions
- **Tidy Modelling Compliance**: All code follows TMwR patterns for reproducibility and consistency
- **Comprehensive Review Options**: Choose between detailed comprehensive or concise summary reviews
- **Safe Amendment Mode**: Corrected code saved to subfolders with REVIEW_NOTES.md documenting all changes
- **Progressive Disclosure**: Skills load methodology knowledge only when needed for token efficiency
### How It Works
The plugin provides specialized agents for each ITC methodology:
- **Method selection** - ITC Architect guides you to the appropriate method based on data and assumptions
- **Analysis execution** - Specialist agents (pairwise, NMA, MAIC, STC, ML-NMR) implement rigorous analyses
- **Code review** - ITC Code Reviewer identifies methodological errors and optionally amends code
- **Methodology guidance** - Skills provide deep knowledge on demand
**Example**: Asking about MAIC automatically activates the `maic-methodology` skill with ESS thresholds, weight diagnostics interpretation, and anchored vs unanchored decision frameworks.
## Quick Start
### Step 1: Add the Plugin
Add this plugin to Claude Code:
```bash
/plugin add choxos/ITC-agents
```
### Step 2: Start Using Agents
The agents are now available for ITC analyses:
```bash
# Get method recommendation
"I have IPD from our trial and AgD from a competitor. Help me choose an ITC method."
# Run specific analysis
"Conduct a MAIC analysis with these data, checking ESS and covariate balance."
# Review existing code
"Review my NMA code for methodological issues - comprehensive review please."
```
## ITC Methods Covered
| Method | R Packages | When to Use |
|--------|------------|-------------|
| **Pairwise Meta-Analysis** | `meta`, `metafor`, `bayesmeta` | Direct comparison with multiple trials |
| **Network Meta-Analysis** | `netmeta`, `gemtc` | Connected network allowing indirect comparisons |
| **MAIC** | `maicplus` | IPD vs AgD with population differences (weighting) |
| **STC** | `stc` | IPD vs AgD with population differences (regression) |
| **ML-NMR** | `multinma` | Combined IPD/AgD network with population adjustment |
## Agents
### Strategic Planning
| Agent | Model | Purpose |
|-------|-------|---------|
| **itc-architect** | Opus | Master strategist for evidence assessment and method selection |
### Method Specialists
| Agent | Model | Packages | Expertise |
|-------|-------|----------|-----------|
| **pairwise-meta-analyst** | Sonnet | `meta`, `metafor`, `bayesmeta` | Heterogeneity, publication bias, forest plots |
| **nma-specialist** | Sonnet | `netmeta`, `gemtc` | Consistency, rankings, league tables |
| **maic-specialist** | Sonnet | `maicplus` | Weight estimation, ESS, Bucher method |
| **stc-specialist** | Sonnet | `stc` | Effect modifiers, centering, outcome regression |
| **ml-nmr-specialist** | Sonnet | `multinma` | Integration points, population adjustment |
### Quality Assurance
| Agent | Model | Purpose |
|-------|-------|---------|
| **itc-code-reviewer** | Opus | Methodological review with optional code amendment |
## Methodology Skills
Progressive disclosure skills provide deep methodology knowledge:
| Skill | Content |
|-------|---------|
| **tidy-itc-workflow** | TMwR patterns, reproducibility, data validation, result tibbles |
| **pairwise-ma-methodology** | Fixed vs random effects, I²/τ² interpretation, publication bias |
| **nma-methodology** | Transitivity, consistency assessment, ranking interpretation |
| **maic-methodology** | ESS thresholds (>50%), weight diagnostics, covariate selection |
| **stc-methodology** | Effect modifier identification, centering, MAIC comparison |
| **ml-nmr-methodology** | Integration points, marginal vs conditional effects |
### Skill Activation
Skills activate automatically based on context:
```
User: "What ESS is acceptable for my MAIC?"
→ Activates maic-methodology skill
→ Provides ESS interpretation table (>70% good, 50-70% acceptable, <30% poor)
→ Suggests strategies for improving ESS
```
## Workflow Commands
### `/itc-analysis` - Complete ITC Analysis
Orchestrates multi-agent workflow from start to finish:
```
/itc-analysis
Design and execute a complete MAIC analysis comparing Treatment A
to Treatment B using our IPD and published competitor data.
```
**Workflow Phases:**
1. **Evidence Assessment** (itc-architect) - Map studies, identify data types
2. **Method Selection** (itc-architect) - Recommend approach with justification
3. **Data Preparation** (itc-code-reviewer) - Validate and prepare data
4. **Primary Analysis** (appropriate specialist) - Execute analysis with diagnostics
5. **Code Review** (itc-code-reviewer) - Validate implementation
6. **Final Reporting** (itc-architect) - Synthesize results
### `/itc-review` - Code Review Workflow
```
/itc-review
Review my MAIC analysis code:
review_type: comprehensive
action: amend
output_folder: ./reviewed/
```
**Options:**
- `review_type`: `comprehensive` (detailed) | `summary` (bullet points)
- `action`: `review_only` | `amend` (create corrected files)
- `output_folder`: Path for amended files (default: `./amended/`)
**Output Structure (amend mode):**
```
project/
├── analysis.R # Original (NEVER modified)
└── amended/
├── analysis_amended.R # Corrected version
├── REVIEW_NOTES.md # Change summary
└── backup/
└── analysis_original.R
```
## Popular Use Cases
### Method Selection Guidance
```
Help me choose an ITC method. I have:
- IPD from our Phase 3 trial (Treatment A vs Placebo, n=450)
- Published AgD from competitor trial (Treatment B vs Placebo, n=380)
- Populations differ in age (median 58 vs 65) and prior therapy (35% vs 52%)
```
**Response includes:**
- Recommendation: Anchored MAIC or STC
- Justification referencing NICE DSU TSD 18
- Assumption checklist
- Sensitivity analysis plan
### MAIC Analysis with Diagnostics
```
Run anchored MAIC for response rate:
- Match on: age, sex, ECOG status, prior therapy
- Check ESS and covariate balance
- Use bootstrap CIs (1000 iterations)
- Compare with STC as sensitivity
```
**Agent activates:**
- `maic-methodology` skill for ESS interpretation
- Provides complete `maicplus` code with diagnostics
- Flags if ESS < 50% with mitigation strategies
### NMA with Consistency Assessment
```
Conduct Bayesian NMA for this 8-treatment network:
- Check transitivity across comparisons
- Test consistency via node-splitting
- Generate league table and SUCRA rankings
- Use informative priors for heterogeneity
```
**Agent provides:**
- Network visualization code
- Complete `gemtc` implementation
- Convergence diagnostics (R-hat, traces)
- Interpretation of rankings with uncertainty
### Code Review with Amendment
```
Review my meta-analysis code for methodological issues:
review_type: comprehensive
action: amend
library(meta)
ma <- metabin(events.e, n.e, events.c, n.c,
data = studies, sm = "OR")
forest(ma)
```
**Review identifies:**
- Missing: `method.tau = "REML"`, `hakn = TRUE`
- Missing: prediction intervals, heterogeneity assessment
- Missing: publication bias check (if ≥10 studies)
- Creates amended code with all corrections
## Methodology References
### Primary Guidelines
- **[NICE DSU TSD 2](https://www.sheffield.ac.uk/nice-dsu/tsds/full-list)** - Network meta-analysis
- **[NICE DSU TSD 18](https://www.sheffield.ac.uk/nice-dsu/tsds/full-list)** - Population-adjusted indirect comparisons
- **[Cochrane Handbook](https://training.cochrane.org/handbook)** - Systematic reviews
- **[PRISMA-NMA](http://prisma-statement.org/Extensions/NetworkMetaAnalysis)** - Reporting guidelines
### Key Papers
- Dias et al. (2018). Network Meta-Analysis for Decision Making
- Phillippo et al. (2018). Methods for Population-Adjusted Indirect Comparisons
- Phillippo et al. (2020). Multilevel Network Meta-Regression
- Signorovitch et al. (2010). Matching-Adjusted Indirect Comparisons
- Higgins et al. (2019). Cochrane Handbook, Chapter 10
### R Package Documentation
- [meta](https://cran.r-project.org/package=meta) - General Package for Meta-Analysis
- [metafor](https://www.metafor-project.org/) - Meta-Analysis Package for R
- [bayesmeta](https://cran.r-project.org/package=bayesmeta) - Bayesian Random-Effects Meta-Analysis
- [netmeta](https://cran.r-project.org/package=netmeta) - Network Meta-Analysis using Frequentist Methods
- [gemtc](https://cran.r-project.org/package=gemtc) - Network Meta-Analysis Using Bayesian Methods
- [maicplus](https://hta-pharma.github.io/maicplus/) - Matching Adjusted Indirect Comparison
- [multinma](https://dmphillippo.github.io/multinma/) - Multilevel Network Meta-Regression
## Architecture
### Repository Structure
```
ITC-agents/
├── .claude-plugin/
│ └── marketplace.json # Plugin registration
├── plugins/
│ └── itc-modelling/
│ ├── agents/
│ │ ├── itc-architect.md # Method selection (Opus)
│ │ ├── pairwise-meta-analyst.md # meta/metafor/bayesmeta
│ │ ├── nma-specialist.md # netmeta/gemtc
│ │ ├── maic-specialist.md # maicplus
│ │ ├── stc-specialist.md # stc
│ │ ├── ml-nmr-specialist.md # multinma
│ │ └── itc-code-reviewer.md # Code review (Opus)
│ ├── commands/
│ │ ├── itc-analysis.md # Multi-agent orchestration
│ │ └── itc-review.md # Code review workflow
│ └── skills/
│ ├── tidy-itc-workflow/ # TMwR patterns
│ ├── pairwise-ma-methodology/ # MA methodology
│ ├── nma-methodology/ # NMA methodology
│ ├── maic-methodology/ # MAIC methodology
│ ├── stc-methodology/ # STC methodology
│ └── ml-nmr-methodology/ # ML-NMR methodology
├── docs/ # Additional documentation
├── LICENSE # MIT License
└── README.md # This file
```
### Design Principles
1. **Tidy Modelling Compliance** - All code follows TMwR patterns (workflows, recipes, consistent interfaces)
2. **Assumption Transparency** - Every method explicitly checks and documents assumptions
3. **Safe Code Handling** - Original files never modified; amendments in subfolders
4. **Progressive Disclosure** - Skills load deep knowledge only when activated
5. **Reproducibility First** - Seeds, package versions, session info always documented
### Model Assignment
| Role | Model | Rationale |
|------|-------|-----------|
| **Strategic** (itc-architect) | Opus | Complex reasoning for method selection |
| **Specialists** (5 agents) | Sonnet | Efficient execution of defined methodologies |
| **Review** (itc-code-reviewer) | Opus | Deep analysis for error detection |
## Contributing
Contributions welcome! Please ensure:
1. **Methodology** - Follows NICE DSU guidance and Cochrane standards
2. **R Patterns** - Matches package APIs exactly
3. **Tidy Principles** - TMwR-compliant code
4. **Assumptions** - Clearly documented and checked
5. **Testing** - Example code verified to run
### Adding New Content
```bash
# Add a new agent
plugins/itc-modelling/agents/new-specialist.md
# Add a new skill
plugins/itc-modelling/skills/new-methodology/SKILL.md
# Update marketplace.json with new components
.claude-plugin/marketplace.json
```
## Resources
### Claude Code Documentation
- [Claude Code Overview](https://docs.anthropic.com/en/docs/claude-code)
- [Plugins Guide](https://docs.anthropic.com/en/docs/claude-code/plugins)
- [Subagents Guide](https://docs.anthropic.com/en/docs/claude-code/sub-agents)
- [Agent Skills](https://docs.anthropic.com/en/docs/agents-and-tools/agent-skills)
### ITC Methodology Resources
- [NICE DSU Technical Support Documents](https://www.sheffield.ac.uk/nice-dsu/tsds/full-list)
- [Cochrane Training](https://training.cochrane.org/)
- [R-HTA Consortium](https://r-hta.org/)
## License
MIT License - see [LICENSE](LICENSE) file for details.
## Author
**Ahmad Sofi-Mahmudi**
---
*Expert ITC agents built with Claude Code following best practices in evidence synthesis methodology.*