Orchestrate agent team for meta-analysis pipeline. Creates team, spawns teammates, manages task list and handoffs between pipeline stages.
Coordinate multiple Claude Code instances as a team for parallel meta-analysis work.
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in .claude/settings.local.jsonma-end-to-end workflow)| Role | Teammate Name | Stages | File Ownership | Model |
|---|---|---|---|---|
| Protocol Architect | protocol-architect | 00-01 | 01_protocol/** | sonnet |
| Search Specialist | search-specialist | 02 | 02_search/** | sonnet |
| Screening Reviewer A | screener-a | 03 | 03_screening/** (reviewer 1 columns) | sonnet |
| Screening Reviewer B | screener-b | 03 | 03_screening/** (reviewer 2 columns) | sonnet |
| Fulltext Manager | fulltext-manager | 04 | 04_fulltext/** | sonnet |
| Data Extractor | data-extractor | 05 | 05_extraction/** | sonnet |
| Statistician | statistician | 06 | 06_analysis/** | opus |
| Manuscript Writer | manuscript-writer | 07 | 07_manuscript/** | opus |
| QA Auditor | qa-auditor | 08-09 | 08_reviews/**, 09_qa/** | sonnet |
Note: Not all roles are needed for every run. The lead selects roles based on which stages need work.
These stages have hard sequential dependencies — spawn one at a time.
protocol-architect → wait for completion01_protocol/pico.yaml and 01_protocol/eligibility.md existsearch-specialist → wait for completion02_search/round-01/dedupe.bib exists with > 0 entriesDual-review requires two independent reviewers working simultaneously.
screener-a AND screener-b simultaneouslyuv run ma-screening-quality/scripts/dual_review_agreement.py \
--file projects/{{project-name}}/03_screening/round-01/decisions.csv \
--col-a Reviewer1_Decision --col-b Reviewer2_Decision \
--out projects/{{project-name}}/03_screening/round-01/agreement.md
These stages depend on prior outputs.
fulltext-manager → wait for completion04_fulltext/manifest.csv and 04_fulltext/fulltext_decisions.csv existdata-extractor → wait for completion05_extraction/round-01/extraction.csv existsstatistician → wait for completion06_analysis/figures/ and 06_analysis/tables/ existManuscript and QA can work in parallel.
manuscript-writer AND qa-auditor simultaneouslymanuscript-writer drafts sections from analysis outputsqa-auditor runs GRADE assessment and PRISMA checklistCreate these tasks at team start. The lead creates all tasks, teammates claim them.
1. "Develop protocol and PICO" [no dependencies]
→ owner: protocol-architect
→ done when: 01_protocol/pico.yaml, eligibility.md, search-plan.md exist
2. "Run literature search and deduplication" [depends: 1]
→ owner: search-specialist
→ done when: 02_search/round-01/dedupe.bib exists
3. "Screen titles/abstracts - Reviewer 1" [depends: 2]
→ owner: screener-a
→ done when: Reviewer1_Decision column populated in decisions.csv
4. "Screen titles/abstracts - Reviewer 2" [depends: 2]
→ owner: screener-b
→ done when: Reviewer2_Decision column populated in decisions.csv
5. "Reconcile screening and compute kappa" [depends: 3, 4]
→ owner: lead
→ done when: agreement.md shows kappa ≥ 0.60, included.bib created
6. "Retrieve full-text PDFs" [depends: 5]
→ owner: fulltext-manager
→ done when: 04_fulltext/manifest.csv exists
7. "Full-text eligibility screening" [depends: 6]
→ owner: fulltext-manager
→ done when: fulltext_decisions.csv and ft_agreement.md exist
8. "Extract study data and assess RoB" [depends: 7]
→ owner: data-extractor
→ done when: 05_extraction/round-01/extraction.csv exists
9. "Run meta-analysis in R" [depends: 8]
→ owner: statistician
→ done when: 06_analysis/figures/ and tables/ populated
10. "Draft manuscript" [depends: 9]
→ owner: manuscript-writer
→ done when: 07_manuscript/index.qmd exists
11. "GRADE assessment and peer review" [depends: 9]
→ owner: qa-auditor
→ done when: 08_reviews/grade_summary.csv exists
12. "Publication QA and PRISMA checklist" [depends: 10, 11]
→ owner: qa-auditor
→ done when: 09_qa/pipeline-checklist.md complete
Each stage produces specific artifacts that the next stage consumes.
| From → To | Handoff Artifacts | Validation |
|---|---|---|
| 01 → 02 | pico.yaml, eligibility.md, search-plan.md | pico.yaml exists, has population + intervention fields |
| 02 → 03 | round-01/dedupe.bib, round-01/log.md | dedupe.bib has > 0 entries |
| 03 → 04 | round-01/included.bib, round-01/agreement.md | kappa ≥ 0.60 in agreement.md |
| 04 → 05 | fulltext_decisions.csv, ft_agreement.md | FT kappa ≥ 0.60, ≥ 1 included study |
| 05 → 06 | round-01/extraction.csv, data-dictionary.md | extraction.csv has required columns |
| 06 → 07 | figures/*.png, tables/*.csv | All figures ≥ 300 DPI |
| 06 → 08 | All analysis outputs | validation.md passes |
| 07+08 → 09 | index.qmd, grade_summary.csv | Both exist |
To spawn a teammate:
uv run tooling/python/team_spawn_helper.py --project {{project-name}} --role {{role-name}}
Available roles: protocol-architect, search-specialist, screening-reviewer, fulltext-manager, data-extractor, statistician, manuscript-writer, qa-auditor
manuscript-writer → qa-auditor: "Draft ready for review at 07_manuscript/index.qmd"qa-auditor → manuscript-writer: "Revision needed: [specific feedback]"| Gate | Threshold | Action if Failed |
|---|---|---|
| Screening kappa | ≥ 0.60 | Lead resolves conflicts, does NOT spawn Stage 04 |
| FT screening kappa | ≥ 0.60 | Lead resolves conflicts, does NOT spawn Stage 05 |
| Extraction completeness | All included studies extracted | Lead identifies gaps, messages data-extractor |
| Figure DPI | ≥ 300 | Lead rejects, messages statistician to regenerate |
| PRISMA checklist | 27/27 items | Lead identifies gaps, assigns to relevant teammate |
All 8 roles. Use for complete meta-analysis from TOPIC.txt to manuscript.
Only screener-a + screener-b. Use when Stage 02 is complete and dual-review is needed.
Lead handles kappa computation and conflict resolution.
Only statistician + manuscript-writer + qa-auditor. Use when Stage 05 is complete.
Three teammates work in parallel on analysis, writing, and review.
If a team session is interrupted:
uv run tooling/python/project_status.py --project {{project-name}} --verbose
| Scenario | Handling |
|---|---|
| Teammate crashes mid-stage | Lead detects via idle notification; spawns replacement with partial progress context |
| NMA vs pairwise routing | Lead handles Stage 03b gate; spawns statistician with appropriate SKILL.md reference |
| Teammate context exhaustion | Teammate messages lead before hitting limit; lead spawns fresh teammate with checkpoint |
| Large project (50+ studies) | Split extraction across 2-3 data-extractor teammates, each assigned study subsets |
| Dual-review independence | screener-a and screener-b MUST NOT message each other until both complete |