From 955485ee967b482ed42876df2c9f81498e03579e Mon Sep 17 00:00:00 2001 From: JC Rojas <126191042+sajor2000@users.noreply.github.com> Date: Mon, 26 Oct 2026 22:23:07 -0500 Subject: [PATCH 1/4] fix(research): correct scientific verification and design contracts --- .../case.yaml | 55 +++++++++++ .../prompt.md | 1 + .../method-genome-build-evidence/case.yaml | 66 +++++++++++++ .../method-genome-build-evidence/prompt.md | 1 + .../case.yaml | 88 +++++++++++++++++ .../prompt.md | 1 + .../case.yaml | 66 +++++++++++++ .../prompt.md | 1 + .../method-omics-qc-hidden-aliasing/case.yaml | 66 +++++++++++++ .../method-omics-qc-hidden-aliasing/prompt.md | 1 + .../case.yaml | 55 +++++++++++ .../prompt.md | 1 + .../method-verify-test-contract/case.yaml | 66 +++++++++++++ .../method-verify-test-contract/prompt.md | 1 + .../skill-creator/method-cohort/evals.json | 11 +-- .../method-cohort/trigger-evals.json | 2 +- .../method-genome-build/evals.json | 12 +-- .../method-genome-build/trigger-evals.json | 2 +- .../method-meta-analysis/evals.json | 14 +-- .../method-meta-analysis/trigger-evals.json | 2 +- .../method-model-choice/evals.json | 5 +- .../method-model-choice/trigger-evals.json | 2 +- .../skill-creator/method-omics-qc/evals.json | 14 +-- .../method-omics-qc/trigger-evals.json | 2 +- .../skill-creator/method-question/evals.json | 11 +-- .../method-question/trigger-evals.json | 2 +- .../skill-creator/method-verify/evals.json | 11 ++- .../method-verify/trigger-evals.json | 2 +- plugins/methodsmith/README.md | 9 ++ .../references/eligibility-windows.md | 4 +- .../skills/method-genome-build/SKILL.md | 4 +- .../scripts/audit_build.py | 93 +++++++++++++----- .../skills/method-meta-analysis/SKILL.md | 8 +- .../references/effect-parser.md | 12 ++- .../references/pooling-formulas.md | 2 +- .../scripts/effect_uncertainty.R | 61 ++++++++++++ .../scripts/pool_effects.R | 30 +++--- .../references/forward-temporal-validation.md | 11 +++ .../references/ml-training-protocol.md | 15 +-- .../skills/method-omics-qc/SKILL.md | 4 +- .../references/batch-confound-rules.md | 6 +- .../skills/method-question/SKILL.md | 14 +-- .../methodsmith/skills/method-verify/SKILL.md | 4 +- .../method-verify/references/check-catalog.md | 4 +- .../method-verify/scripts/verify_stats.py | 84 ++++++++++------ tests/genome-build-audit.test.ts | 79 +++++++++++++++ tests/pool-effects-runtime.test.ts | 35 +++++++ tests/verify-stats.test.ts | 96 +++++++++++++++++++ 48 files changed, 992 insertions(+), 144 deletions(-) create mode 100644 evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml create mode 100644 evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md create mode 100644 evals/methodsmith/cases/method-genome-build-evidence/case.yaml create mode 100644 evals/methodsmith/cases/method-genome-build-evidence/prompt.md create mode 100644 evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml create mode 100644 evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md create mode 100644 evals/methodsmith/cases/method-model-choice-forward-time/case.yaml create mode 100644 evals/methodsmith/cases/method-model-choice-forward-time/prompt.md create mode 100644 evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml create mode 100644 evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md create mode 100644 evals/methodsmith/cases/method-question-indicated-bundle/case.yaml create mode 100644 evals/methodsmith/cases/method-question-indicated-bundle/prompt.md create mode 100644 evals/methodsmith/cases/method-verify-test-contract/case.yaml create mode 100644 evals/methodsmith/cases/method-verify-test-contract/prompt.md create mode 100644 plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R create mode 100644 plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md create mode 100644 tests/genome-build-audit.test.ts diff --git a/evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml b/evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml new file mode 100644 index 00000000..a52e2831 --- /dev/null +++ b/evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml @@ -0,0 +1,55 @@ +{ + "schema_version": "1.0", + "id": "method-cohort-baseline-observability", + "target": { + "kind": "skill", + "name": "method-cohort", + "source": "plugins/methodsmith/skills/method-cohort/SKILL.md" + }, + "mode": "forward", + "prompt_path": "evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md", + "fixtures": [], + "required_behaviors": [ + "eligible-at-index", + "review-informative-censoring" + ], + "prohibited_behaviors": [ + "requires-full-future-enrollment" + ], + "criteria": [ + { + "id": "eligible-at-index", + "description": "eligible at index", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "eligible_at_index", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "requires-full-future-enrollment", + "description": "requires full future enrollment", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "requires_full_future_enrollment", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "review-informative-censoring", + "description": "review informative censoring", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "review_informative_censoring", + "expected": true, + "weight": 2, + "hard_gate": true + } + ], + "threshold": 1, + "limitations": [ + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + ] +} diff --git a/evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md b/evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md new file mode 100644 index 00000000..137dd5cc --- /dev/null +++ b/evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md @@ -0,0 +1 @@ +Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable. Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain followup handling and why the outcome's observability differs from baseline eligibility in response.md. No network or package installation. diff --git a/evals/methodsmith/cases/method-genome-build-evidence/case.yaml b/evals/methodsmith/cases/method-genome-build-evidence/case.yaml new file mode 100644 index 00000000..3088587a --- /dev/null +++ b/evals/methodsmith/cases/method-genome-build-evidence/case.yaml @@ -0,0 +1,66 @@ +{ + "schema_version": "1.0", + "id": "method-genome-build-evidence", + "target": { + "kind": "skill", + "name": "method-genome-build", + "source": "plugins/methodsmith/skills/method-genome-build/SKILL.md" + }, + "mode": "forward", + "prompt_path": "evals/methodsmith/cases/method-genome-build-evidence/prompt.md", + "fixtures": [], + "required_behaviors": [ + "mismatch-status", + "no-evidence-status", + "unavailable-tool-status" + ], + "prohibited_behaviors": [ + "ready" + ], + "criteria": [ + { + "id": "mismatch-status", + "description": "mismatch status", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "mismatch_status", + "expected": "incompatible", + "weight": 2, + "hard_gate": true + }, + { + "id": "no-evidence-status", + "description": "no evidence status", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "no_evidence_status", + "expected": "unknown", + "weight": 2, + "hard_gate": true + }, + { + "id": "unavailable-tool-status", + "description": "unavailable tool status", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "unavailable_tool_status", + "expected": "uninspected", + "weight": 2, + "hard_gate": true + }, + { + "id": "ready", + "description": "ready", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "ready", + "expected": false, + "weight": 2, + "hard_gate": true + } + ], + "threshold": 1, + "limitations": [ + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + ] +} diff --git a/evals/methodsmith/cases/method-genome-build-evidence/prompt.md b/evals/methodsmith/cases/method-genome-build-evidence/prompt.md new file mode 100644 index 00000000..38ef1db4 --- /dev/null +++ b/evals/methodsmith/cases/method-genome-build-evidence/prompt.md @@ -0,0 +1 @@ +Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each. Write workspace/advice.json with mismatch_status, no_evidence_status, unavailable_tool_status and ready (boolean). Do not install tools or infer a build from the chr prefix. Save the full explanation in response.md. diff --git a/evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml b/evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml new file mode 100644 index 00000000..264d6466 --- /dev/null +++ b/evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml @@ -0,0 +1,88 @@ +{ + "schema_version": "1.0", + "id": "method-meta-uncertainty-contract", + "target": { + "kind": "skill", + "name": "method-meta-analysis", + "source": "plugins/methodsmith/skills/method-meta-analysis/SKILL.md" + }, + "mode": "forward", + "prompt_path": "evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md", + "fixtures": [], + "required_behaviors": [ + "normal90-eligible", + "t9-eligible", + "profile-eligible", + "reported-log-se-eligible", + "invent-symmetric-interval" + ], + "prohibited_behaviors": [ + "unknown-eligible" + ], + "criteria": [ + { + "id": "normal90-eligible", + "description": "normal90 eligible", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "normal90_eligible", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "t9-eligible", + "description": "t9 eligible", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "t9_eligible", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "unknown-eligible", + "description": "unknown eligible", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "unknown_eligible", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "profile-eligible", + "description": "profile eligible", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "profile_eligible", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "reported-log-se-eligible", + "description": "reported log se eligible", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "reported_log_se_eligible", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "invent-symmetric-interval", + "description": "invent symmetric interval", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "invent_symmetric_interval", + "expected": false, + "weight": 2, + "hard_gate": true + } + ], + "threshold": 1, + "limitations": [ + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + ] +} diff --git a/evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md b/evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md new file mode 100644 index 00000000..94cf49ba --- /dev/null +++ b/evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md @@ -0,0 +1 @@ +Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network. diff --git a/evals/methodsmith/cases/method-model-choice-forward-time/case.yaml b/evals/methodsmith/cases/method-model-choice-forward-time/case.yaml new file mode 100644 index 00000000..87c0e8e0 --- /dev/null +++ b/evals/methodsmith/cases/method-model-choice-forward-time/case.yaml @@ -0,0 +1,66 @@ +{ + "schema_version": "1.0", + "id": "method-model-choice-forward-time", + "target": { + "kind": "skill", + "name": "method-model-choice", + "source": "plugins/methodsmith/skills/method-model-choice/SKILL.md" + }, + "mode": "forward", + "prompt_path": "evals/methodsmith/cases/method-model-choice-forward-time/prompt.md", + "fixtures": [], + "required_behaviors": [ + "period-transport-is-forward-validation", + "review-outcome-maturation-gap", + "group-patient-encounters" + ], + "prohibited_behaviors": [ + "uses-future-training" + ], + "criteria": [ + { + "id": "uses-future-training", + "description": "uses future training", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "uses_future_training", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "period-transport-is-forward-validation", + "description": "period transport is forward validation", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "period_transport_is_forward_validation", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "review-outcome-maturation-gap", + "description": "review outcome maturation gap", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "review_outcome_maturation_gap", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "group-patient-encounters", + "description": "group patient encounters", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "group_patient_encounters", + "expected": true, + "weight": 2, + "hard_gate": true + } + ], + "threshold": 1, + "limitations": [ + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + ] +} diff --git a/evals/methodsmith/cases/method-model-choice-forward-time/prompt.md b/evals/methodsmith/cases/method-model-choice-forward-time/prompt.md new file mode 100644 index 00000000..d9ad3c67 --- /dev/null +++ b/evals/methodsmith/cases/method-model-choice-forward-time/prompt.md @@ -0,0 +1 @@ +Review only the validation component of a binary clinical prediction strategy using method-model-choice. We want performance for future deployment. Data periods are 2020, 2021 and 2022; outcomes take 90 days to mature and patients can have repeated encounters. A collaborator proposes LeaveOneGroupOut on calendar year, training on every other year to assess the left-out year. No model fit or scaffold is requested. Write workspace/advice.json with booleans uses_future_training (for your recommended forward-validation design), period_transport_is_forward_validation, review_outcome_maturation_gap, group_patient_encounters. State the corrected split rule and distinguish the collaborator's period-transport target in response.md. No network or package installation. diff --git a/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml new file mode 100644 index 00000000..79895c6b --- /dev/null +++ b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml @@ -0,0 +1,66 @@ +{ + "schema_version": "1.0", + "id": "method-omics-qc-hidden-aliasing", + "target": { + "kind": "skill", + "name": "method-omics-qc", + "source": "plugins/methodsmith/skills/method-omics-qc/SKILL.md" + }, + "mode": "forward", + "prompt_path": "evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md", + "fixtures": [], + "required_behaviors": [ + "qc-pass", + "batch-deletion-establishes-validity", + "rank-check-required-without-pc-separation" + ], + "prohibited_behaviors": [ + "design-identifiable" + ], + "criteria": [ + { + "id": "design-identifiable", + "description": "design identifiable", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "design_identifiable", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "qc-pass", + "description": "qc pass", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "qc_pass", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "batch-deletion-establishes-validity", + "description": "batch deletion establishes validity", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "batch_deletion_establishes_validity", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "rank-check-required-without-pc-separation", + "description": "rank check required without pc separation", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "rank_check_required_without_pc_separation", + "expected": true, + "weight": 2, + "hard_gate": true + } + ], + "threshold": 1, + "limitations": [ + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + ] +} diff --git a/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md new file mode 100644 index 00000000..493aabd0 --- /dev/null +++ b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md @@ -0,0 +1 @@ +Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC. Write workspace/advice.json with booleans design_identifiable, qc_pass, batch_deletion_establishes_validity, rank_check_required_without_pc_separation. Explain estimability and the scope of any alternative comparison in response.md. Do not run DE or correction; no network. diff --git a/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml b/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml new file mode 100644 index 00000000..589007b8 --- /dev/null +++ b/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml @@ -0,0 +1,55 @@ +{ + "schema_version": "1.0", + "id": "method-question-indicated-bundle", + "target": { + "kind": "skill", + "name": "method-question", + "source": "plugins/methodsmith/skills/method-question/SKILL.md" + }, + "mode": "forward", + "prompt_path": "evals/methodsmith/cases/method-question-indicated-bundle/prompt.md", + "fixtures": [], + "required_behaviors": [ + "requires-all-five-completed-one-hour", + "mortality-endpoint" + ], + "prohibited_behaviors": [ + "unindicated-pressors-fail-adherence" + ], + "criteria": [ + { + "id": "unindicated-pressors-fail-adherence", + "description": "unindicated pressors fail adherence", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "unindicated_pressors_fail_adherence", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "requires-all-five-completed-one-hour", + "description": "requires all five completed one hour", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "requires_all_five_completed_one_hour", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "mortality-endpoint", + "description": "mortality endpoint", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "mortality_endpoint", + "expected": "30-day all-cause mortality", + "weight": 2, + "hard_gate": true + } + ], + "threshold": 1, + "limitations": [ + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + ] +} diff --git a/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md b/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md new file mode 100644 index 00000000..68d29560 --- /dev/null +++ b/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md @@ -0,0 +1 @@ +Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md. diff --git a/evals/methodsmith/cases/method-verify-test-contract/case.yaml b/evals/methodsmith/cases/method-verify-test-contract/case.yaml new file mode 100644 index 00000000..16c03f2d --- /dev/null +++ b/evals/methodsmith/cases/method-verify-test-contract/case.yaml @@ -0,0 +1,66 @@ +{ + "schema_version": "1.0", + "id": "method-verify-test-contract", + "target": { + "kind": "skill", + "name": "method-verify", + "source": "plugins/methodsmith/skills/method-verify/SKILL.md" + }, + "mode": "forward", + "prompt_path": "evals/methodsmith/cases/method-verify-test-contract/prompt.md", + "fixtures": [], + "required_behaviors": [ + "incorrect-negative", + "noninferiority", + "sequential" + ], + "prohibited_behaviors": [ + "unknown-sidedness" + ], + "criteria": [ + { + "id": "incorrect-negative", + "description": "incorrect negative", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "incorrect_negative", + "expected": "FAIL", + "weight": 2, + "hard_gate": true + }, + { + "id": "noninferiority", + "description": "noninferiority", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "noninferiority", + "expected": "PASS", + "weight": 2, + "hard_gate": true + }, + { + "id": "sequential", + "description": "sequential", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "sequential", + "expected": "WARN", + "weight": 2, + "hard_gate": true + }, + { + "id": "unknown-sidedness", + "description": "unknown sidedness", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "unknown_sidedness", + "expected": "WARN", + "weight": 2, + "hard_gate": true + } + ], + "threshold": 1, + "limitations": [ + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + ] +} diff --git a/evals/methodsmith/cases/method-verify-test-contract/prompt.md b/evals/methodsmith/cases/method-verify-test-contract/prompt.md new file mode 100644 index 00000000..0d53572b --- /dev/null +++ b/evals/methodsmith/cases/method-verify-test-contract/prompt.md @@ -0,0 +1 @@ +Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed. Write workspace/advice.json with status strings incorrect_negative, noninferiority, sequential, unknown_sidedness (PASS/WARN/FAIL). Retain the claims sent to the checker as workspace/stat-claims.json. Save your full response in response.md. diff --git a/evals/methodsmith/skill-creator/method-cohort/evals.json b/evals/methodsmith/skill-creator/method-cohort/evals.json index 0a74bdb8..ca19e7ae 100644 --- a/evals/methodsmith/skill-creator/method-cohort/evals.json +++ b/evals/methodsmith/skill-creator/method-cohort/evals.json @@ -30,14 +30,13 @@ }, { "id": 3, - "prompt": "Make me a cohort of 'heart failure patients' from our claims data and then run the Cox model for SGLT2 vs DPP4 on readmission. I don't have a code list yet, just use whatever ICD codes make sense.", - "expected_output": "Elicits the missing cohort facts (vocabulary and pinned version, index event, windows, code list) one question at a time instead of inventing codes or locking a vague population, and declines to run the Cox model.", + "prompt": "Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable. Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain followup handling and why the outcome's observability differs from baseline eligibility in response.md. No network or package installation.", + "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", "files": [], "expectations": [ - "Does not invent an unpinned ICD code list or present the vague 'heart failure patients' population as a locked cohort", - "Asks for a pinned vocabulary version (e.g. ICD-10-CM year) and the index event before generating SQL", - "Asks one decision-changing question at a time", - "Does not run the Cox model or any statistical analysis, routing that to later workflow (method-work after method-data-qa)" + "eligible_at_index is true in the requested structured advice, consistent with the explanation", + "requires_full_future_enrollment is false in the requested structured advice, consistent with the explanation", + "review_informative_censoring is true in the requested structured advice, consistent with the explanation" ] } ] diff --git a/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json b/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json index 0b7b740a..6633d66b 100644 --- a/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Define our study cohort in OMOP: adults with incident atrial fibrillation 2016-2022, index = first AF diagnosis, exclude prior anticoagulant use in 365 days, require 1 year continuous observation. Need concept sets, SQL, and a CONSORT waterfall.", "should_trigger": true}, + {"query": "Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable.", "should_trigger": true}, {"query": "build cohort for new users of GLP-1 RAs in MarketScan, washout 180d, continuous enrollment 365d prior, ICD-10-CM 2024 + NDC lists. give me the waterfall counts too", "should_trigger": true}, {"query": "We need a reproducible, version-pinned definition of our sepsis ICU cohort with explicit inclusion/exclusion windows before data QA starts.", "should_trigger": true}, {"query": "The OMOP vocabulary was refreshed to 2024-Q2. Replay the existing T2DM-statin cohort definition against the new vocab and regenerate the waterfall.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-genome-build/evals.json b/evals/methodsmith/skill-creator/method-genome-build/evals.json index 77cfbfa7..7efd6c81 100644 --- a/evals/methodsmith/skill-creator/method-genome-build/evals.json +++ b/evals/methodsmith/skill-creator/method-genome-build/evals.json @@ -28,14 +28,14 @@ }, { "id": 3, - "prompt": "half our VCFs are hg19 and half hg38, just liftover everything to hg38 with CrossMap and re-run the annotation so I can merge them today", - "expected_output": "Does not run liftover or re-annotation without explicit workflow scope; audits and records the build mismatch, and asks for confirmation of the liftover workflow scope (chain file, target build, validation) before any pipeline run.", + "prompt": "Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each. Write workspace/advice.json with mismatch_status, no_evidence_status, unavailable_tool_status and ready (boolean). Do not install tools or infer a build from the chr prefix. Save the full explanation in response.md.", + "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", "files": [], "expectations": [ - "Does not execute CrossMap/liftover or re-annotation as part of this skill", - "Identifies and reports the mixed hg19/hg38 builds as a P0 mismatch", - "Asks for explicit workflow scope (chain file source, target manifest, post-liftover validation) before any liftover is run", - "Does not download chain files or references automatically" + "mismatch_status is \"incompatible\" in the requested structured advice, consistent with the explanation", + "no_evidence_status is \"unknown\" in the requested structured advice, consistent with the explanation", + "unavailable_tool_status is \"uninspected\" in the requested structured advice, consistent with the explanation", + "ready is false in the requested structured advice, consistent with the explanation" ] } ] diff --git a/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json b/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json index e347257a..1ec07fc9 100644 --- a/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Declare the reference genome for our WGS project: refs/Homo_sapiens.GRCh38.dna.primary_assembly.fa and gencode.v44 GTF. Write a manifest with md5s that we commit.", "should_trigger": true}, + {"query": "Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each.", "should_trigger": true}, {"query": "reviewer asks 'what genome build did you use' - audit all our bams/vcfs and make a supplementary traceability table proving it", "should_trigger": true}, {"query": "Some of our BED files use 'chr1' and others use '1' and bedtools intersect returns nothing. Check contig naming consistency against the declared build.", "should_trigger": true}, {"query": "Our counts matrix was built with GENCODE 36 but the manifest says 44. How bad is that and what else drifted? Audit the whole project.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-meta-analysis/evals.json b/evals/methodsmith/skill-creator/method-meta-analysis/evals.json index 763ca7b2..60f3f86c 100644 --- a/evals/methodsmith/skill-creator/method-meta-analysis/evals.json +++ b/evals/methodsmith/skill-creator/method-meta-analysis/evals.json @@ -31,14 +31,16 @@ }, { "id": 3, - "prompt": "What effect size should I assume for the SAP power section on statins and post-op delirium? Just give me a pooled OR.", - "expected_output": "Finds no methods CSV path and no __CE_METHOD_EXTRACT__ signal, so it stops and asks the user to run method-extract first or pass a CSV path instead of inventing an estimate.", + "prompt": "Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network.", + "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", "files": [], "expectations": [ - "Checks for an explicit CSV argument and a __CE_METHOD_EXTRACT__ signal in recent chat before proceeding", - "Asks the user to load method-extract first or provide a methods CSV path", - "Does not fabricate a pooled OR or cite effect estimates from memory", - "Does not write files under analysis/effect-size/ without an input table" + "normal90_eligible is true in the requested structured advice, consistent with the explanation", + "t9_eligible is true in the requested structured advice, consistent with the explanation", + "unknown_eligible is false in the requested structured advice, consistent with the explanation", + "profile_eligible is false in the requested structured advice, consistent with the explanation", + "reported_log_se_eligible is true in the requested structured advice, consistent with the explanation", + "invent_symmetric_interval is false in the requested structured advice, consistent with the explanation" ] } ] diff --git a/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json b/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json index d54024e6..ef3175ac 100644 --- a/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Our HR CSV mixes adjusted conditional and unadjusted marginal effects from overlapping cohorts. Can it give the power anchor?", "should_trigger": true}, + {"query": "Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool.", "should_trigger": true}, {"query": "I keep picking the most optimistic OR from the lit for my sample size. Can you take the extracted methods table and give me a defensible pooled estimate with I^2?", "should_trigger": true}, {"query": "method-extract just finished (__CE_METHOD_EXTRACT__ csv=analysis/pubmed/aki-methods.csv n=11). next step: combine the effect estimates for the SAP effect-size assumption", "should_trigger": true}, {"query": "need a forest plot + pooled SMD (hedges g) from the 8 pilot/feasibility studies in analysis/pubmed/cbt-insomnia-methods.csv to justify the detectable difference in my R21", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-model-choice/evals.json b/evals/methodsmith/skill-creator/method-model-choice/evals.json index 5a6b484c..2987a835 100644 --- a/evals/methodsmith/skill-creator/method-model-choice/evals.json +++ b/evals/methodsmith/skill-creator/method-model-choice/evals.json @@ -17,7 +17,7 @@ }, { "id": 2, - "prompt": "which model should I use to predict 30-day readmission? haven't looked at the data yet, not sure if it's one row per admission or per patient.", + "prompt": "which model should I use to predict 30-day readmission? haven't looked at the data yet, not sure if it's one row per admission or per patient. The planned use is deployment in future calendar years; distinguish that target from leaving each historical year out while training on all other years.", "expected_output": "Does not choose a final model; marks the strategy blocked or provisional because the data grain and estimand are unresolved, asks one decision-changing question, and writes no code scaffold.", "files": [], "expectations": [ @@ -26,7 +26,8 @@ "Asks a single decision-changing question at a time about grain/unit of analysis or estimand", "Lists the exact future QA facts (e.g. grain, repeat admissions per patient) required to promote the recommendation", "Does not open patient-level files merely to avoid asking about the missing design decision", - "If writing a prediction strategy memo, writes its version-1.0 decisions.json sidecar with matching blocked/provisional status, null unknowns, and explicit unresolved questions" + "If writing a prediction strategy memo, writes its version-1.0 decisions.json sidecar with matching blocked/provisional status, null unknowns, and explicit unresolved questions", + "Keeps unresolved grain blocked/provisional and, for future deployment, requires earlier-to-later validation rather than future-to-past training, with patient grouping and outcome-maturation review." ] }, { diff --git a/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json b/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json index 0d8276cd..05968b7b 100644 --- a/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Review a repeated-measures model with a patient random intercept plus fully unstructured within-patient residual covariance.", "should_trigger": true}, + {"query": "Review only the validation component of a binary clinical prediction strategy using method-model-choice. We want performance for future deployment. Data periods are 2020, 2021 and 2022; outcomes take 90 days to mature and patients can have repeated encounters. A collaborator proposes LeaveOneGroupOut on calendar year, training on every other year to assess the left-out year. No model fit or scaffold is requested.", "should_trigger": true}, {"query": "choose between Cox and Fine-Gray for time to dialysis with death as a competing event, and justify it with literature - python lifelines stack", "should_trigger": true}, {"query": "Our outcome is ICU length of stay with lots of zeros and a long tail. Which regression family and link should we use, and what diagnostics and fallbacks should be prespecified?", "should_trigger": true}, {"query": "Help me justify the random-effects structure for a crossed design (patients x raters) on pain scores; glmmTMB is in renv.lock.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-omics-qc/evals.json b/evals/methodsmith/skill-creator/method-omics-qc/evals.json index e26b35ad..dce1898e 100644 --- a/evals/methodsmith/skill-creator/method-omics-qc/evals.json +++ b/evals/methodsmith/skill-creator/method-omics-qc/evals.json @@ -7,7 +7,7 @@ "expected_output": "A modality-specific RNA-seq QA run that screens PCA for batch-condition confounding, writes the HTML and markdown reports under reports/bioinfo-qa/, and emits a GO/NO-GO marker without running differential expression.", "files": [], "expectations": [ - "Runs PCA on a variance-stabilized or log-CPM matrix colored by batch and condition, checks full aliasing (rank of ~ batch + condition) and reports Cramér's V between batch and condition; emits a P0 'batch is confounded with condition' finding for full aliasing or V above 0.5, or a P1 partial confound for 0.3-0.5, recommending batch in the DE design rather than a corrected matrix", + "Runs PCA on a variance-stabilized or log-CPM matrix colored by batch and condition, checks full aliasing (rank of ~ batch + condition) and reports Cram\u00e9r's V between batch and condition; emits a P0 'batch is confounded with condition' finding for full aliasing or V above 0.5, or a P1 partial confound for 0.3-0.5, recommending batch in the DE design rather than a corrected matrix", "Writes reports/bioinfo-qa/.md (and the MultiQC-rendered .html) containing modality and N, per-sample pass/warn/fail table, batch confound assessment, sample swap assessment, aggregate metrics, and a sign-off block", "Ends with exactly __CE_BIOINFO_QC_PASS__ or __CE_BIOINFO_QC_FAIL__ wave= blockers=", "Does not run DESeq2 differential expression or apply ComBat/RUV/SVA batch removal; only flags", @@ -30,14 +30,14 @@ }, { "id": 3, - "prompt": "QC this folder please: /data/proj_x/ has a bunch of fastq.gz files and also a counts.tsv someone dropped in there. Sample sheet is proj_x/meta.csv. Then go ahead and run the differential expression for tumor vs normal.", - "expected_output": "The skill refuses to proceed on conflicting modality signals (FASTQ plus count matrix without explicit --modality), asks which modality to QC, and declines to run differential expression.", + "prompt": "Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC. Write workspace/advice.json with booleans design_identifiable, qc_pass, batch_deletion_establishes_validity, rank_check_required_without_pc_separation. Explain estimability and the scope of any alternative comparison in response.md. Do not run DE or correction; no network.", + "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", "files": [], "expectations": [ - "Refuses to proceed with checks because of mixed FASTQ and count-matrix signals and asks for an explicit --modality", - "Does not run differential expression and states that DE is outside this skill", - "Asks only one decision-changing question at a time (e.g. modality first) rather than a questionnaire", - "Does not emit __CE_BIOINFO_QC_PASS__" + "design_identifiable is false in the requested structured advice, consistent with the explanation", + "qc_pass is false in the requested structured advice, consistent with the explanation", + "batch_deletion_establishes_validity is false in the requested structured advice, consistent with the explanation", + "rank_check_required_without_pc_separation is true in the requested structured advice, consistent with the explanation" ] } ] diff --git a/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json b/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json index 64528a40..dc88291a 100644 --- a/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "We just got 96 FASTQ pairs back from the core for the ATAC-seq project (/data/atac/run_0915). Run FastQC/MultiQC and flag outlier samples before anyone starts peak calling.", "should_trigger": true}, + {"query": "Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC.", "should_trigger": true}, {"query": "Before DESeq2, check whether plate is confounded with treatment arm in our RNA-seq counts (counts/salmon_merged.tsv, sample sheet meta/samples.csv has condition and batch columns).", "should_trigger": true}, {"query": "EPIC methylation IDATs from two array batches in /data/methyl/idat. Need bisulfite conversion, detection p-values, and sex-prediction discordance checked before the EWAS.", "should_trigger": true}, {"query": "pls do a sample swap check on the WGS crams, sheet has declared sex + family IDs. somalier if you can", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-question/evals.json b/evals/methodsmith/skill-creator/method-question/evals.json index 94e98cd8..ba423fba 100644 --- a/evals/methodsmith/skill-creator/method-question/evals.json +++ b/evals/methodsmith/skill-creator/method-question/evals.json @@ -29,14 +29,13 @@ }, { "id": 3, - "prompt": "Research question: what proportion of adult ED visits for syncope at our 4 hospitals in 2022 resulted in admission, and how did it vary by site? Purely descriptive. Make the YAML, then go ahead and pull the PubMed papers and draft the SAP too while you're at it.", - "expected_output": "Produces the research-question YAML with comparator recorded as null for the descriptive design, flags any FINER dimension scored 2 or below, test-runs the suggested query only for its hit count, and declines to run the literature search or write the SAP, pointing to method-pubmed and method-plan as next steps.", + "prompt": "Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md.", + "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", "files": [], "expectations": [ - "Records the comparator slot explicitly as null because the design is descriptive", - "Surfaces plainly any FINER dimension scored 2 or below (e.g., novelty) as a flag to acknowledge, not a refusal", - "Runs at most a hit-count test of the suggested query; does not run the literature search or extract papers, and hands off to method-pubmed via the __CE_RESEARCH_QUESTION__ signal", - "Does not draft the SAP; names method-plan as the next step for SAP writing" + "unindicated_pressors_fail_adherence is false in the requested structured advice, consistent with the explanation", + "requires_all_five_completed_one_hour is false in the requested structured advice, consistent with the explanation", + "mortality_endpoint is \"30-day all-cause mortality\" in the requested structured advice, consistent with the explanation" ] } ] diff --git a/evals/methodsmith/skill-creator/method-question/trigger-evals.json b/evals/methodsmith/skill-creator/method-question/trigger-evals.json index dcc5d425..f070d0a2 100644 --- a/evals/methodsmith/skill-creator/method-question/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-question/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Turn this into a proper PICO with FINER scores: 'early mobilization in mechanically ventilated adults and ICU-acquired weakness'. I need the YAML so we can search PubMed next.", "should_trigger": true}, + {"query": "Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts.", "should_trigger": true}, {"query": "my question is kinda vague - 'do sepsis bundles help?' - can you tighten it up into population/exposure/comparator/outcome and suggest a design before i do the lit search", "should_trigger": true}, {"query": "Harden the survivor idea from docs/ideation/2026-09-12-ideation-doc.md (#2: deprescribing in SNF residents) into a structured research question with a suggested PubMed query.", "should_trigger": true}, {"query": "method-pubmed returned 4,800 hits with no MeSH alignment for 'AI sepsis outcomes'. Help me narrow the actual research question first.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-verify/evals.json b/evals/methodsmith/skill-creator/method-verify/evals.json index dde04b39..5d121d5d 100644 --- a/evals/methodsmith/skill-creator/method-verify/evals.json +++ b/evals/methodsmith/skill-creator/method-verify/evals.json @@ -31,13 +31,14 @@ }, { "id": 3, - "prompt": "Audit two finished analyses: survival has 80 events versus a prespecified required 300 despite adequate enrollment; prediction validation applies a locked training-fitted imputer without outcome labels. Our analyzable N excludes the planned dropout inflation. Report which checks can pass.", - "expected_output": "Reports survival information as FAIL because 80 observed events are below the prespecified 300; treats the attrition comparator as PASS when analyzable N matches the SAP; and does not fail a deployment-faithful prediction imputer for excluding validation outcomes.", + "prompt": "Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed. Write workspace/advice.json with status strings incorrect_negative, noninferiority, sequential, unknown_sidedness (PASS/WARN/FAIL). Retain the claims sent to the checker as workspace/stat-claims.json. Save your full response in response.md.", + "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", "files": [], "expectations": [ - "Reports a FAIL because 80 observed events are below the required 300", - "Reports the attrition comparator as PASS when analyzable N matches the SAP, distinct from recruitment inflation", - "Does not report a FAIL merely because a deployment-faithful prediction imputer excludes validation outcomes" + "incorrect_negative is \"FAIL\" in the requested structured advice, consistent with the explanation", + "noninferiority is \"PASS\" in the requested structured advice, consistent with the explanation", + "sequential is \"WARN\" in the requested structured advice, consistent with the explanation", + "unknown_sidedness is \"WARN\" in the requested structured advice, consistent with the explanation" ] } ] diff --git a/evals/methodsmith/skill-creator/method-verify/trigger-evals.json b/evals/methodsmith/skill-creator/method-verify/trigger-evals.json index 48e6d1c1..e9687584 100644 --- a/evals/methodsmith/skill-creator/method-verify/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-verify/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Verify a survival analysis with 80 of 300 required events and a prediction pipeline that imputes validation predictors without validation outcomes.", "should_trigger": true}, + {"query": "Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed.", "should_trigger": true}, {"query": "verify output/ before I mark this task complete: leakage, seeds, renv.lock, figures", "should_trigger": true}, {"query": "Can you run the mid-workflow verification gate on analysis/output/models/a3/? Expected N comes from the data-QA report", "should_trigger": true}, {"query": "sanity check pls -- my OR came out 0.6 but hypothesis said harmful exposure, plus I want to make sure no PHI slipped into outputs", "should_trigger": true}, diff --git a/plugins/methodsmith/README.md b/plugins/methodsmith/README.md index 8a9336f7..500068ee 100644 --- a/plugins/methodsmith/README.md +++ b/plugins/methodsmith/README.md @@ -413,6 +413,15 @@ universal NI convention. Phenotype validation rejects duplicate patient keys. Tracking preserves the chosen validation design and keeps full sensitive logs restricted; only reviewed, disclosure-safe aggregate summaries enter Git. +Printed-statistic checks preserve rounding and declared t/z sidedness; unsupported +P-value constructions stay unchecked. Power anchors require source-reported SEs +or declared Wald interval methods, confidence levels and degrees of freedom. +Genome audits distinguish compatible header evidence from unknown or uninspected +files. Prediction validation separates forward time from period transport, and +omics identifiability is checked independently of PCA displays. Cohort eligibility +uses baseline observability; later loss is handled in follow-up rather than by +requiring future enrollment. + ### Numbers locked to raw data Clinical journals, reviewers, and data-sharing audits ask where each number in a diff --git a/plugins/methodsmith/skills/method-cohort/references/eligibility-windows.md b/plugins/methodsmith/skills/method-cohort/references/eligibility-windows.md index be034193..1998e107 100644 --- a/plugins/methodsmith/skills/method-cohort/references/eligibility-windows.md +++ b/plugins/methodsmith/skills/method-cohort/references/eligibility-windows.md @@ -16,9 +16,9 @@ Without wash-out: prevalent users contaminate the analysis with selection bias. ## 3. Continuous-enrollment window -Time during which the patient must be observable in the data source. For claims: continuous insurance coverage. For EHR: no true enrollment exists, so use an explicit observability proxy (e.g., at least one encounter in each look-back year, or the source's `observation_period`) and report it as a limitation; requiring healthcare contact can select sicker patients. Common: 365 days prior + the entire follow-up period. +Baseline time during which the patient must be observable in the data source, assessable through index (for example, 365 days before index). For claims, define insurance coverage; for EHR, declare an observability proxy or the source's `observation_period` and its limitations. Requiring healthcare contact can select sicker patients. Do not require observation/enrollment for the entire future follow-up period as baseline eligibility. A person eligible at index who disenrolls on day 90 remains eligible; handle subsequent follow-up under the prespecified censoring/ascertainment rules below. -Without this: missingness is informative (patient simply left the data source); leads to differential outcome ascertainment. +State the observability and censoring assumptions: leaving the data source can produce informative loss or differential outcome ascertainment, but a future-enrollment eligibility requirement does not solve that bias. ## 4. Follow-up window diff --git a/plugins/methodsmith/skills/method-genome-build/SKILL.md b/plugins/methodsmith/skills/method-genome-build/SKILL.md index 6072c6d5..083316b5 100644 --- a/plugins/methodsmith/skills/method-genome-build/SKILL.md +++ b/plugins/methodsmith/skills/method-genome-build/SKILL.md @@ -35,7 +35,7 @@ Pins the reference genome and annotation versions used in a bioinformatics study ### Step 1: Declare the build (`--ref-fasta` / `--annotation-gtf`) -Hash the reference FASTA, parse its first contig name, look up the build: +Hash the reference FASTA and establish the assembly from source provenance, diagnostic contig lengths and available sequence checksums. A first contig name or `chr` prefix does not identify a genome build. The values below are an illustrative example (GENCODE 44, equivalent to Ensembl release 110); resolve the current release, URLs, md5s, and counts for the build you actually declare rather than copying these. @@ -106,7 +106,7 @@ If `--check` found any P0 → exit non-zero, print a clear report. The user reso ## References -`scripts/audit_build.py` — supports Step 2 by walking a directory for BAM/CRAM, VCF, and GTF/GFF3 files, flagging differing contig MD5s, mixed `chr1`/`1` naming, and a chromosome-1 MD5 that does not match `--declared` (`GRCh37`, `GRCh38`, or `T2T`). It writes its findings as YAML to `--manifest` and a Markdown report to `--report`, prints `__CE_GENOME_BUILD__ declared= files= issues= manifest= report=`, and exits 2 on any issue, including P1 naming mismatches; classify each issue by the Step 2 severities before gating. `--manifest` is overwritten, so never point it at `analysis/genome-build/manifest.yaml`: +`scripts/audit_build.py` supports Step 2 with build declarations, diagnostic chromosome-1/8 lengths, available chromosome-1 MD5s, and naming consistency. `--declared` accepts `GRCh37`, `GRCh38` and `T2T` (diagnostic lengths support CHM13 v2.0 only). Each file is `verified` for compatible header evidence, `incompatible`, `unknown`, or `uninspected`; this does not establish complete sequence identity or annotation-release parity. Missing tools, absent evidence, unsupported T2T versions, or no inspected files block a clean result. It writes YAML (JSON for a `.json` destination), a Markdown report, and `__CE_GENOME_BUILD__ declared= files= issues= manifest= report=`. Exit 2 requires resolution, including P1 naming issues; a prefix difference alone is not a build mismatch. Complete the other Step 2 manual checks before declaring the audit complete. `--manifest` is overwritten, so never point it at `analysis/genome-build/manifest.yaml`: ```bash SKILL_DIR=""; diff --git a/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py b/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py index 293958ed..d053185a 100644 --- a/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py +++ b/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py @@ -22,7 +22,7 @@ import argparse import gzip -import hashlib +import json import re import shutil import subprocess @@ -33,10 +33,13 @@ KNOWN_BUILDS = { "GRCh37": {"chr1_md5_no_chr": "1b22b98cdeb4a9304cb5d48026a85128", # 1000G GRCh37 + "lengths": {"1": 249250621, "8": 146364022}, "synonyms": ("GRCh37", "hg19", "b37")}, "GRCh38": {"chr1_md5_no_chr": "6aef897c3d6ff0c78aff06ac189178dd", # GRCh38 + "lengths": {"1": 248956422, "8": 145138636}, "synonyms": ("GRCh38", "hg38")}, "T2T": {"chr1_md5_no_chr": None, + "lengths": {"1": 248387328, "8": 146259331}, # CHM13 v2.0 only "synonyms": ("T2T-CHM13", "CHM13", "T2T")}, } @@ -77,7 +80,11 @@ def inspect_vcf(path: Path) -> dict: if line.startswith("##contig="): m_id = re.search(r"ID=([^,>]+)", line) m_md5 = re.search(r"md5=([^,>]+)", line) + m_len = re.search(r"length=([^,>]+)", line) + m_assembly = re.search(r"assembly=([^,>]+)", line) contigs.append({"sn": m_id.group(1) if m_id else None, + "ln": m_len.group(1) if m_len else None, + "assembly": m_assembly.group(1).strip('"') if m_assembly else None, "m5": m_md5.group(1) if m_md5 else None}) elif line.startswith("##reference="): ref = line.strip().split("=", 1)[1] @@ -115,6 +122,8 @@ def chr_style(name: str | None) -> str: def audit(root: Path, declared: str) -> tuple[list[dict], list[str]]: findings: list[dict] = [] issues: list[str] = [] + if not root.is_dir(): + return findings, ["audit root is not an existing directory; no files inspected"] bam_files = list(root.rglob("*.bam")) + list(root.rglob("*.cram")) vcf_files = list(root.rglob("*.vcf")) + list(root.rglob("*.vcf.gz")) @@ -124,13 +133,18 @@ def audit(root: Path, declared: str) -> tuple[list[dict], list[str]]: for f in bam_files: findings.append(inspect_bam(f)) for f in vcf_files: findings.append(inspect_vcf(f)) for f in gtf_files: findings.append(inspect_gtf(f)) + if not findings: + return findings, ["no supported reference-aware files found; build not verified"] # Cross-file consistency checks. md5_by_contig: dict[str, set[str]] = defaultdict(set) chr_styles_seen: set[str] = set() for f in findings: - if "error" in f: continue + if "error" in f: + f["status"] = "uninspected" + issues.append(f"{f['path']}: uninspected: {f['error']}") + continue for c in f.get("contigs", []) or []: if c.get("m5"): md5_by_contig[c["sn"]].add(c["m5"]) chr_styles_seen.add(chr_style(c["sn"])) @@ -144,17 +158,50 @@ def audit(root: Path, declared: str) -> tuple[list[dict], list[str]]: if {"chr-prefixed", "unprefixed"} <= chr_styles_seen: issues.append("both chr-prefixed and unprefixed contig naming detected; " - "GRCh37 vs GRCh38 confusion is a frequent retraction cause") + "naming differs, which alone does not identify a build") # Build-specific MD5 check on chromosome 1. spec = KNOWN_BUILDS.get(declared, {}) expected_md5 = spec.get("chr1_md5_no_chr") - if expected_md5: - for f in findings: - for c in f.get("contigs", []) or []: - if c.get("sn") in ("1", "chr1") and c.get("m5") and c["m5"] != expected_md5: - issues.append(f"{f['path']} chromosome 1 MD5={c['m5']} " - f"but declared build {declared} expects {expected_md5}") + for f in findings: + if f.get("status") == "uninspected": + continue + evidence, mismatches = [], [] + declarations = [f.get("reference"), f.get("header_meta")] + declarations += [c.get("assembly") for c in f.get("contigs", [])] + unsupported_t2t = False + for declaration in filter(None, declarations): + for build, known in KNOWN_BUILDS.items(): + if any(re.search(r"(? None: args.manifest.parent.mkdir(parents=True, exist_ok=True) args.report.parent.mkdir(parents=True, exist_ok=True) - # Manifest YAML (sorted, deterministic) - try: - import yaml - args.manifest.write_text(yaml.safe_dump( - {"declared_build": args.declared, "files": findings}, - sort_keys=True, allow_unicode=True)) - except ImportError: - # JSON is valid YAML; keep the manifest machine-readable without PyYAML. - import json - args.manifest.write_text(json.dumps( - {"declared_build": args.declared, "files": findings}, - sort_keys=True, indent=2, ensure_ascii=False) + "\n") - print("audit_build.py: PyYAML not installed; wrote the manifest as JSON " - "(run `python3 -m pip install --upgrade pyyaml` for YAML output)", file=sys.stderr) + payload = {"declared_build": args.declared, "verification_scope": "header evidence; not complete sequence identity", + "files": findings} + serialized = json.dumps(payload, sort_keys=True, indent=2, ensure_ascii=False) + "\n" + if args.manifest.suffix != ".json": + try: + import yaml + except ImportError: + pass # JSON is valid YAML when PyYAML is unavailable. + else: + serialized = yaml.safe_dump(payload, sort_keys=True, allow_unicode=True) + args.manifest.write_text(serialized) # Markdown report md = [f"# Genome-build audit", "", f"Declared build: **{args.declared}**", f"Files inspected: {len(findings)}", + "Scope: header declarations, diagnostic contig lengths and available MD5s; not complete sequence identity.", f"Issues found: **{len(issues)}**", ""] if issues: md.append("## Issues") md.extend(f"- {x}" for x in issues) else: - md.append("No build mismatches detected.") + md.append("All inspected files have compatible build-header evidence; sequence identity was not established.") args.report.write_text("\n".join(md) + "\n") print(f"__CE_GENOME_BUILD__ declared={args.declared} files={len(findings)} " diff --git a/plugins/methodsmith/skills/method-meta-analysis/SKILL.md b/plugins/methodsmith/skills/method-meta-analysis/SKILL.md index c58728be..a34931c8 100644 --- a/plugins/methodsmith/skills/method-meta-analysis/SKILL.md +++ b/plugins/methodsmith/skills/method-meta-analysis/SKILL.md @@ -27,7 +27,7 @@ Bridges `method-extract` (which collects what prior studies REPORTED) and `metho ## Prerequisites -- A methods CSV with at minimum: pmid, year, sample_size, effect_size_reported (and ideally lo / hi 95% CI) +- A methods CSV with pmid, year, sample_size and effect_size_reported; pooling additionally needs source-reported uncertainty or a reconstructible declared Wald interval per `references/effect-parser.md`. - Select a protocol-compatible target: population/comparison, outcome/horizon, effect scale/unit, adjustment specification, study design and independent contribution. A modal metric is not evidence of compatibility; resolve unknowns before fitting. ## Evidence access @@ -48,6 +48,8 @@ If neither an explicit path nor the signal is present, ask the user to load the Read the methods CSV. Parse the `effect_size_reported` field: extract metric type (OR/HR/RR/MD/SMD), point, lo, hi. Use `references/effect-parser.md` patterns, normalise adjusted labels (`aHR` -> `HR`) while keeping the `adjusted` flag (adjusted and unadjusted OR/HR are not interchangeable; see that reference), and write `analysis/effect-size/-parsed.csv` plus the parsing script next to it (the parsed-CSV contract is in that reference; `scripts/pool_effects.R` reads the parsed CSV, not the raw methods table). Drop rows where parsing fails; report count of dropped rows. Where a row's effect, CI, or metric is ambiguous and the paper is lawfully available, read the results section (see Evidence access) rather than guess, and note the row's `evidence_level` (`full_text` or `abstract`) in the included-studies CSV. +Validate each row's uncertainty before selection: use a source-reported SE on the correct analysis scale, or the declared Wald confidence level/method/df and source-rounding tolerance in `references/effect-parser.md`. Do not reconstruct unknown or asymmetric non-Wald intervals as normal 95% intervals. Resolve or explicitly exclude an unsupported row under the protocol, retaining its reason; never silently create its variance or hand off its numeric anchor. + ### Step 2: Filter to comparable studies Filter to the selected scientific target first; read the complete parsed contract in `references/effect-parser.md`. Resolve adjusted/marginal differences, units and overlapping cohorts before any fit. Save the selection code and excluded-study reasons. Write only the selected compatible rows to `analysis/effect-size/-selected.csv`; retain the full parsed CSV and exclusions for audit. Then filter: @@ -67,7 +69,7 @@ SKILL_DIR=""; Rscript "$SKILL_DIR/scripts/pool_effects.R" --in analysis/effect-size/-selected.csv --metric HR --out analysis/effect-size/-pooled.md ``` -Requires R with current CRAN `meta` and `ggplot2` (`install.packages(c("meta", "ggplot2"))`). +Requires the project's R environment with `meta` and `ggplot2`; report missing packages rather than installing them from this skill. If N ≥ 3: - For OR / HR / RR: log-transform → random-effects REML (use an explicitly configured R `meta::metagen` or `metafor::rma`; Python statsmodels Paule-Mandel is a different method) @@ -147,7 +149,7 @@ Both forms carry the selected compatibility artifact in `contract=`. `method-pow ## What this skill does NOT do - Does not do a full systematic-review meta-analysis (no risk-of-bias scoring, no PRISMA flow); that's a separate study type, use the `method-checklist` skill to register it as PRISMA -- Does not impute missing CIs (drops studies with missing CI rather than guessing) +- Does not invent missing uncertainty; source-reported SEs are usable without a CI, while unresolved SE/CI construction blocks that row's numeric use. - Does not handle network meta-analysis (use `netmeta` package directly) - Does not compute power (that's `method-power`) diff --git a/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md b/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md index 4b606495..0fd1d1fa 100644 --- a/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md +++ b/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md @@ -52,10 +52,14 @@ using the protocol and confounding assessment, not the largest reported benefit Write `analysis/effect-size/-parsed.csv` with: -- `pmid, year, first_author, sample_size, metric, effect, effect_lo, effect_hi`; +- `pmid, year, first_author, sample_size, metric, effect`, with source CI bounds `effect_lo, effect_hi` when available; - `population, comparator, estimand, outcome, time_horizon, adjustment_specification, adjusted, analysis_scale, unit, study_design, independent_unit_id`. +Every row needs `uncertainty_source` naming the read source/table. Prefer a source-reported `standard_error` with `standard_error_scale=log` for OR/HR/RR or `identity` for MD/SMD; never log a ratio-scale SE. Without a reported SE, require `ci_method` (`wald_normal` or `wald_t`), `ci_level` as a fraction (e.g., `0.95` or `0.90`), and `ci_df` for t intervals. Also declare `ci_rounding_tolerance`: the maximum midpoint discrepancy justified by the source's printed rounding on the analysis scale, not a free tolerance to make an asymmetric interval pass. Set zero for exact unrounded bounds. The bundled `scripts/effect_uncertainty.R`, called by the pooling helper, validates and reconstructs these SEs; its numerical extraction uses base R. + +Unknown, profile-likelihood, exact or bootstrap intervals cannot be converted by assuming a normal 95% CI. Obtain a justified source SE/variance or use an appropriate method outside this scalar helper; keep unresolved rows accounted for and block their use as a numeric power anchor. A valid source SE does not itself establish normality or scientific compatibility. + Resolve these scientific declarations from the protocol and read sources; do not fill unknown fields with invented labels to satisfy the validator. `adjusted` is `true`, `false` or `not_applicable` when genuinely appropriate. Use `none` @@ -87,7 +91,7 @@ read it before power/SAP use. ``` MD 2.4 (95% CI 1.1-3.7) mmHg -> metric=MD, point=2.4, lo=1.1, hi=3.7, unit=mmHg SMD 0.34 (0.18-0.50) -> metric=SMD, point=0.34, lo=0.18, hi=0.50 -mean diff 4.5 (SE 1.2) -> metric=MD, point=4.5, se=1.2 (compute CI: 4.5 +/- 1.96*1.2) +mean diff 4.5 (SE 1.2) -> metric=MD, effect=4.5, standard_error=1.2, standard_error_scale=identity (retain source provenance) ``` ## P-value-only reports @@ -122,6 +126,6 @@ Label every converted value as a conversion, with its inputs and their sources. ## Edge cases -- Asymmetric CI on log scale (lo too far from point given hi): refit by computing SE = (log(hi) - log(lo)) / (2 * 1.96) and using log(point) +/- 1.96 * SE -- Confidence levels other than 95%: convert (e.g., 90% CI -> SE = (hi - lo) / (2 * 1.645)) +- Asymmetric CI on the analysis scale beyond documented rounding: inspect its construction; never refit or symmetrize the published interval to manufacture a Wald SE. +- Known symmetric Wald CI: `SE = (upper - lower) / (2 * critical)` on the analysis scale, with `critical = qnorm((1+ci_level)/2)` or `qt((1+ci_level)/2, ci_df)`. Confidence level and degrees of freedom come from the source, not a default. See Cochrane Handbook chapter 6, section on obtaining SEs from confidence intervals: https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-06. - Multiple effect estimates per paper (primary + sensitivity): use the primary diff --git a/plugins/methodsmith/skills/method-meta-analysis/references/pooling-formulas.md b/plugins/methodsmith/skills/method-meta-analysis/references/pooling-formulas.md index 5bbd281a..6eaaa34a 100644 --- a/plugins/methodsmith/skills/method-meta-analysis/references/pooling-formulas.md +++ b/plugins/methodsmith/skills/method-meta-analysis/references/pooling-formulas.md @@ -14,7 +14,7 @@ For formal site-to-lead synthesis or a systematic review, use `method-clif-meta- For each study `i`: - `theta_i` = effect size on the analytic scale (log(HR), log(OR), MD, SMD) -- `v_i = se_i^2`, with `se_i = (hi - lo) / (2 * 1.96)` from a 95% CI (on the log scale for ratio metrics) +- `v_i = se_i^2`, from a source-reported SE or a validated symmetric Wald interval with its actual confidence level and, for t intervals, df. Use the log scale for ratio metrics. `scripts/effect_uncertainty.R` enforces the contract in `effect-parser.md`; division by 3.92 is limited to a normal 95% interval. - `w_i = 1 / (v_i + tau^2)` = random-effects inverse-variance weight ## tau^2 by REML diff --git a/plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R b/plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R new file mode 100644 index 00000000..ee693819 --- /dev/null +++ b/plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R @@ -0,0 +1,61 @@ +# Source-reported or explicitly reconstructed uncertainty on the analysis scale. +effect_uncertainty <- function(dat, is_ratio) { + fail <- function(message) stop("pool_effects.R: uncertainty: ", message, call. = FALSE) + field <- function(name, i, default = NA) { + if (name %in% names(dat)) dat[[name]][[i]] else default + } + dat$te <- if (is_ratio) log(dat$effect) else dat$effect + dat$se_te <- numeric(nrow(dat)) + dat$uncertainty_method <- character(nrow(dat)) + if (any(!is.finite(dat$te))) fail("effect must be finite on the analysis scale") + for (i in seq_len(nrow(dat))) { + provenance <- field("uncertainty_source", i) + if (is.na(provenance) || !nzchar(trimws(as.character(provenance)))) { + fail("each row needs uncertainty_source from the read source") + } + se <- field("standard_error", i) + if (!is.na(se)) { + if (!is.numeric(se) || !is.finite(se) || se <= 0) fail("standard_error must be finite and positive") + scale <- field("standard_error_scale", i) + if (is.na(scale) || scale != if (is_ratio) "log" else "identity") { + fail("standard_error_scale must match the analysis scale (log for ratios, identity otherwise)") + } + dat$se_te[[i]] <- se + dat$uncertainty_method[[i]] <- "reported_SE" + next + } + method <- field("ci_method", i) + if (is.na(method) || !method %in% c("wald_normal", "wald_t")) { + fail("CI reconstruction requires wald_normal or wald_t; inspect unknown/non-Wald intervals") + } + level <- field("ci_level", i) + if (!is.numeric(level) || !is.finite(level) || level <= 0 || level >= 1) { + fail("ci_level must be an explicit fraction between 0 and 1") + } + critical <- qnorm((1 + level) / 2) + if (method == "wald_t") { + df <- field("ci_df", i) + if (!is.numeric(df) || !is.finite(df) || df <= 0) fail("wald_t requires positive ci_df") + critical <- qt((1 + level) / 2, df) + } + bounds <- c(field("effect_lo", i), field("effect_hi", i)) + if (!is.numeric(bounds) || any(!is.finite(bounds)) || (is_ratio && any(bounds <= 0))) { + fail("CI bounds must be finite and valid for their scale") + } + if (is_ratio) bounds <- log(bounds) + if (bounds[[1]] >= bounds[[2]] || dat$te[[i]] < bounds[[1]] || dat$te[[i]] > bounds[[2]]) { + fail("CI bounds must be ordered and contain the effect") + } + tolerance <- field("ci_rounding_tolerance", i) + if (!is.numeric(tolerance) || !is.finite(tolerance) || tolerance < 0) { + fail("declare ci_rounding_tolerance on the analysis scale from source rounding") + } + if (abs(mean(bounds) - dat$te[[i]]) > tolerance) { + fail("asymmetric CI exceeds source-rounding tolerance; do not symmetrize it") + } + dat$se_te[[i]] <- diff(bounds) / (2 * critical) + if (!is.finite(dat$se_te[[i]]) || dat$se_te[[i]] <= 0) fail("invalid reconstructed standard error") + dat$uncertainty_method[[i]] <- method + } + dat +} diff --git a/plugins/methodsmith/skills/method-meta-analysis/scripts/pool_effects.R b/plugins/methodsmith/skills/method-meta-analysis/scripts/pool_effects.R index 045914f5..7581cda1 100644 --- a/plugins/methodsmith/skills/method-meta-analysis/scripts/pool_effects.R +++ b/plugins/methodsmith/skills/method-meta-analysis/scripts/pool_effects.R @@ -18,7 +18,7 @@ # [--min-n 0] # # Input CSV must have at minimum: pmid, year, first_author, sample_size, -# metric, effect (point), effect_lo, effect_hi, and reviewed compatibility +# metric, effect (point), reviewed uncertainty (reported SE or declared Wald CI), and compatibility # declarations (population, comparator, estimand, outcome, time_horizon, adjustment_specification, # adjusted, analysis_scale, unit, study_design, independent_unit_id). # The method-extract table @@ -26,8 +26,8 @@ # references/effect-parser.md) and pass the parsed CSV here. # # Filters applied here, each count printed: metric equals --metric exactly -# (normalise aHR -> HR before calling); point and CI present and, for ratio -# metrics, positive, with effect_lo <= effect <= effect_hi; sample_size >= +# (normalise aHR -> HR before calling); finite point, positive for ratio +# metrics; sample_size >= # --min-n (default 0 = no size filter; inverse-variance weights already # down-weight small studies, so a size cutoff is a sensitivity analysis only). @@ -39,6 +39,8 @@ for (pkg in c("meta", "ggplot2")) { } } suppressPackageStartupMessages(library(meta)) +script_path <- sub("^--file=", "", commandArgs()[grepl("^--file=", commandArgs())][1]) +source(file.path(dirname(normalizePath(script_path)), "effect_uncertainty.R")) parse_args <- function(args) { out <- list() @@ -60,7 +62,7 @@ stopifnot(!is.null(a$`in`), !is.null(a$metric), !is.null(a$out)) dat <- read.csv(a$`in`, stringsAsFactors = FALSE) compatibility_fields <- c("population", "comparator", "estimand", "outcome", "time_horizon", "adjustment_specification", "adjusted", "analysis_scale", "unit", "study_design") -needed <- c("pmid", "year", "first_author", "sample_size", "metric", "effect", "effect_lo", "effect_hi", +needed <- c("pmid", "year", "first_author", "sample_size", "metric", "effect", compatibility_fields, "independent_unit_id") missing <- setdiff(needed, names(dat)) if (length(missing) > 0) { @@ -79,9 +81,8 @@ is_ratio <- a$metric %in% c("HR", "OR", "RR", "aOR", "aHR", "aRR", "IRR", "SMR", dat <- dat[!is.na(dat$metric) & dat$metric == a$metric, , drop = FALSE] n_metric_drop <- n_input - nrow(dat) -ok_ci <- !is.na(dat$effect) & !is.na(dat$effect_lo) & !is.na(dat$effect_hi) & - dat$effect_lo <= dat$effect & dat$effect <= dat$effect_hi -if (is_ratio) ok_ci <- ok_ci & dat$effect > 0 & dat$effect_lo > 0 & dat$effect_hi > 0 +ok_ci <- is.finite(dat$effect) +if (is_ratio) ok_ci <- ok_ci & dat$effect > 0 n_ci_drop <- sum(!ok_ci) dat <- dat[ok_ci, , drop = FALSE] @@ -90,7 +91,7 @@ ok_n <- if (min_n > 0) !is.na(dat$sample_size) & dat$sample_size >= min_n else r n_small_drop <- sum(!ok_n) dat <- dat[ok_n, , drop = FALSE] -cat(sprintf("Input rows: %d; dropped %d (metric != %s), %d (missing, non-positive, or inconsistent point/CI), %s; %d studies enter pooling.\n", +cat(sprintf("Input rows: %d; dropped %d (metric != %s), %d (invalid point), %s; %d studies enter pooling.\n", n_input, n_metric_drop, a$metric, n_ci_drop, if (min_n > 0) sprintf("%d (sample_size missing or < %g)", n_small_drop, min_n) else "no size filter", nrow(dat))) @@ -129,20 +130,23 @@ if (nrow(dat) > 0) { } } if (!grepl("\\.md$", a$out)) stop("pool_effects.R: --out must end in .md", call. = FALSE) +dat <- effect_uncertainty(dat, is_ratio) contract_path <- sub("\\.md$", "-contract.csv", a$out) write_contract <- function() { - write.csv(dat[, c("pmid", "independent_unit_id", compatibility_fields), drop = FALSE], + uncertainty_fields <- intersect(c("uncertainty_source", "uncertainty_method", "standard_error", "standard_error_scale", + "ci_method", "ci_level", "ci_df", "ci_rounding_tolerance", "se_te"), names(dat)) + write.csv(dat[, c("pmid", "independent_unit_id", compatibility_fields, uncertainty_fields), drop = FALSE], contract_path, row.names = FALSE, na = "") } if (nrow(dat) < 3) { - cat(sprintf("Only %d studies with metric=%s and complete CI; pooling not meaningful.\n", + cat(sprintf("Only %d studies with metric=%s and validated uncertainty; pooling not meaningful.\n", nrow(dat), a$metric)) cat("Reporting narrative range instead.\n") if (nrow(dat) == 0) { out_md <- c( sprintf("# Effect-size narrative (k = 0, %s)", a$metric), - "No study in the input has this metric with a complete, positive CI.", + "No study in the input has this metric with a valid point.", "Check the metric label (case-sensitive) or widen the search." ) } else { @@ -170,8 +174,6 @@ if (nrow(dat) < 3) { # For ratio metrics: pool on log scale. ratio_metric <- a$metric %in% c("HR", "OR", "RR", "aOR", "aHR", "aRR", "IRR", "SMR", "HRR") if (ratio_metric) { - dat$te <- log(dat$effect) - dat$se_te <- (log(dat$effect_hi) - log(dat$effect_lo)) / (2 * 1.96) # meta only back-transforms summary measures it recognises (OR, RR, HR, IRR); # adjusted or study-specific labels must map to one, or the forest plot and # printed summary stay on the log scale. @@ -179,8 +181,6 @@ if (ratio_metric) { aOR = "OR", aRR = "RR", aHR = "HR", HRR = "HR", SMR = "RR", a$metric) } else { - dat$te <- dat$effect - dat$se_te <- (dat$effect_hi - dat$effect_lo) / (2 * 1.96) sm <- a$metric # MD or SMD } diff --git a/plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md b/plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md new file mode 100644 index 00000000..eedb8f1f --- /dev/null +++ b/plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md @@ -0,0 +1,11 @@ +# Forward temporal validation + +Fix the intended validation target before selecting a splitter. + +- Future deployment requires rolling or expanding calendar windows: train only on earlier observations and assess later periods. Fit preprocessing, tuning, and calibration within the same temporal boundaries. +- Keep patients grouped across training and assessment. Apply a gap or purge when needed for overlapping prediction windows, delayed labels, or outcome maturation; for a 90-day outcome, confirm training labels would be available at the assessment origin. +- `LeaveOneGroupOut` on calendar period uses every other period for training, including future periods. It can assess a justified historical period-transport target, but cannot establish forward performance. Label that target explicitly. +- `TimeSeriesSplit` assumes ordered samples and equally spaced samples for comparable fold durations. Irregular clinical cohorts may require explicit calendar windows. Check its gap units and patient boundaries; a row-count gap does not automatically represent a clinical time interval. +- Preserve chronology even when outcome stratification would improve class balance. Report period-specific sample sizes, events, calibration, and discrimination. + +Source: [scikit-learn TimeSeriesSplit documentation](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html). Site and period transport remain distinct from forward prediction. diff --git a/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md b/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md index e8b17780..860483e2 100644 --- a/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md +++ b/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md @@ -1,6 +1,6 @@ # ML Prediction Training Protocol -Apply after `model-routing.md` fixes the prediction aim and the model family is chosen. This file covers the Python supervised-training loop for risk models: validation design, fold structure, sample size and stability, metrics, imbalance, tuning, candidate learners, device strategy, calibration, thresholds, uncertainty, explainability, and reporting. Route experiment logging to `method-ml-track`, iterative metric optimization loops to `method-optimize`, figure production to `method-figure`, and final documentation to `method-model-card`. Nothing here licenses package installation or touching a locked test set. +Use after `model-routing.md` establishes the prediction aim and family. Route logging to `method-ml-track`, optimization to `method-optimize`, figures to `method-figure`, and documentation to `method-model-card`. Authorize package installation and test-data access first. ## Contents @@ -59,12 +59,13 @@ State one design in the memo before any fitting: |---|---|---| | Bootstrap optimism correction of the whole pipeline | Single-source data; default for small or moderate event counts | Optimism-corrected calibration and discrimination | | Nested CV (tuning inner, performance outer) | Heavy tuning; no spare events | Outer-fold estimate of the whole procedure | -| Internal-external CV (leave one site or period out) | Data from several sites, regions, or calendar periods | Per-cluster performance, pooled, with between-cluster heterogeneity | +| Internal-external CV | Site generalization or justified historical period transport | Per-cluster performance and heterogeneity; not forward prediction | +| Forward temporal validation | Future deployment | Earlier-only training; later assessment after outcome maturation | | Locked held-out test set | Large data where one split leaves enough events for a stable estimate | One test score after model lock | - A random split-sample test set wastes events and gives an unstable estimate in small or moderate data; prefer resampling there and develop on all data (Collins et al., BMJ 2024, PMID 38191193). -- With clustered data (sites, hospitals, practices, periods), use internal-external CV to examine generalizability and heterogeneity across clusters; report pooled performance and its spread, not only an average (Takada et al. 2021, PMID 33836256; de Jong et al. 2021, PMID 33948970). Leave-one-site-out also exposes site-specific calibration drift that random folds hide. -- When a held-out set exists: split once by the independent unit, stratify on outcome, lock it, record when it was unlocked, and score it only after the final model is locked (REFORMS, PMID 38691601; TRIPOD+AI, PMID 38626948). +- For site generalization, report internal-external CV performance and heterogeneity (Takada et al. 2021, PMID 33836256; de Jong et al. 2021, PMID 33948970). Calendar validation must distinguish forward deployment from historical period transport; follow [forward temporal validation](forward-temporal-validation.md) for ordering, grouping, gaps, and splitter assumptions. +- When a held-out set exists: split once by independent unit and deployment time (stratify only when compatible), lock it, record when it was unlocked, and score it only after the final model is locked (REFORMS, PMID 38691601; TRIPOD+AI, PMID 38626948). - Tuning, thresholding, calibration, and model selection belong to development data. - Record the number of configurations evaluated. The best CV score is optimistic by selection; the reported estimate comes from nested CV, internal-external CV, the locked test set, or bootstrap correction, never from the tuning leaderboard. - An "internal only" study states that external validation is still required and, when planning it, sizes it with the Riley external-validation criteria (PMID 38253388). @@ -76,7 +77,9 @@ State one design in the memo before any fitting: | Default development and tuning | 5-fold CV, outcome-stratified | | Small sample, final internal estimate | Repeated CV (for example 5x5) or bootstrap | | Multiple rows per patient | `StratifiedGroupKFold` on patient | -| Several sites or periods | `LeaveOneGroupOut` on site or period for the outer loop | +| Several sites | `LeaveOneGroupOut` on site for the outer loop | +| Forward calendar validation | Rolling/expanding calendar split; no future training observations or immature outcomes | +| Historical period transport | `LeaveOneGroupOut` on period only when explicitly justified and labeled as transport | | Any model comparison | Identical fold assignments across every candidate | - Fit every learning step inside the folds through a `Pipeline`: imputation, scaling, encoding, spline bases, and feature selection all leak when fitted before the split (Kapoor & Narayanan, Patterns 2023, PMID 37720327). @@ -252,7 +255,7 @@ Tuning, calibration, decision curves, stability bootstrap, and explanations wrap ## Completion gates -The protocol is complete when: the Riley sample-size check is reported; the validation design is named and locked, with internal-external CV when sites or periods exist; folds are grouped by the independent unit and stratified; no imbalance correction is applied (or it is justified and recalibrated); the penalized baseline is fit; tuning uses a proper scoring rule with declared space, budget, and seeds; the device is chosen and verified; calibration is assessed with a named method; AUROC, calibration, net benefit, and risk distributions are reported, with AUPRC beside prevalence when used; instability is assessed by bootstrap; subgroup performance is reported; explanations exist on a declared split with figures routed to `method-figure`; and the locked test set, if any, was scored exactly once. +The protocol is complete when: the Riley sample-size check is reported; the validation target/design is locked, respecting sites, patients, and time; distinguish forward validation from period transport; stratify only when compatible; no imbalance correction is applied (or it is justified and recalibrated); the penalized baseline is fit; tuning uses a proper scoring rule with declared space, budget, and seeds; the device is chosen and verified; calibration is assessed with a named method; AUROC, calibration, net benefit, and risk distributions are reported, with AUPRC beside prevalence when used; instability is assessed by bootstrap; subgroup performance is reported; explanations exist on a declared split with figures routed to `method-figure`; and the locked test set, if any, was scored exactly once. ## Evidence seeds diff --git a/plugins/methodsmith/skills/method-omics-qc/SKILL.md b/plugins/methodsmith/skills/method-omics-qc/SKILL.md index 04c4ce9f..d84314c1 100644 --- a/plugins/methodsmith/skills/method-omics-qc/SKILL.md +++ b/plugins/methodsmith/skills/method-omics-qc/SKILL.md @@ -71,9 +71,9 @@ Different modality → different checks. Refuse to proceed if conflicting signal ### Step 3: Batch-effect screening (no removal) -Run PCA on the count or beta matrix. Color points by `batch` (date / lane / plate / center) and `condition` (the experimental variable). If the first 2 PCs separate by batch AND condition is not orthogonal to batch, first check full aliasing with a rank check of the `~ batch + condition` design matrix, then grade the association by Cramér's V between batch and condition (equivalent to |phi| for two-level factors; Pearson r on indicators is undefined for multi-level batches), using the thresholds in `references/batch-confound-rules.md` (project defaults unless the report cites a benchmark per Evidence access): full aliasing or V above 0.5 is a P0 finding; 0.3-0.5 is a P1 partial confound that can be modeled at a cost in power. For a P0, report: +Always inspect the sample-design cross-tabulation, rank of `~ batch + condition`, and estimability of the intended contrast before expression PCA. Complete aliasing is a P0 blocker even when PC1/PC2 show no batch separation; larger unrelated variation can hide it in later PCs. Then run PCA on variance-stabilized/log-CPM counts or the appropriate transformed assay matrix, colored by batch and condition. Grade partial association with Cramér's V (equivalent to |phi| for two-level factors), using the project-default thresholds in `references/batch-confound-rules.md`: V above 0.5 is a P0 review flag; 0.3-0.5 is a P1 warning. V and PCA cannot establish identifiability; distinguish a full-rank but unbalanced design from a non-estimable contrast. For full aliasing, report: -> Batch is confounded with condition. If every batch contains a single condition (full aliasing), no correction or model term can separate batch from biology: re-block the experiment or restrict to within-batch contrasts. If confounding is partial, model batch as a term in the differential-analysis design (`~ batch + condition`) rather than analysing a batch-corrected matrix. +> Batch is confounded with condition. No correction, matching, or stable result after deleting a batch identifies this contrast under full aliasing. Re-block/recollect, or restrict to a different contrast that actually has within-batch support. For an identifiable partially confounded design, model batch in the differential-analysis design (`~ batch + condition`) rather than testing a batch-corrected matrix. ### Step 4: Sample swap screening diff --git a/plugins/methodsmith/skills/method-omics-qc/references/batch-confound-rules.md b/plugins/methodsmith/skills/method-omics-qc/references/batch-confound-rules.md index 8f9c6686..1d9b496d 100644 --- a/plugins/methodsmith/skills/method-omics-qc/references/batch-confound-rules.md +++ b/plugins/methodsmith/skills/method-omics-qc/references/batch-confound-rules.md @@ -15,15 +15,15 @@ The numeric cutoffs here (Cramér's V > 0.5, 0.3-0.5, PC1 > 30% variance, > 90% ## Heuristic warnings (P1) 1. **Batch and condition associated (Cramér's V 0.3-0.5).** Partial confound; model batch in the DE design, at a cost in power. -2. **Some batches have very few samples.** Batch with N=1 or N=2 cannot be used for batch correction. +2. **Some batches have very few samples.** Inspect replication, residual degrees of freedom and contrast support; N=1 or N=2 is a warning, not a universal impossibility rule for every model. 3. **Batch correction applied without inspection.** ComBat / RUV / SVA called blindly; the analyst should look at PCA before and after. ## What to recommend when confounded - **Re-block the experiment.** Often impossible after the fact, but should be the first option. -- **Acknowledge as a limitation; report sensitivity analysis.** Show results with and without one batch; if conclusions stable, OK to publish with caveat. +- **Separate aliasing from partial confounding.** Always check the design matrix and intended contrast independently of PC1/PC2. If a partially confounded contrast remains identifiable, prespecified with/without-batch sensitivity analyses may describe robustness. Stability alone does not establish validity or publication readiness, and cannot rescue full aliasing. - **Use within-batch comparisons only.** If each batch contains both arms, restrict to within-batch contrasts. -- **Adopt a paired / matched design retrospectively.** Match cases and controls within batch. +- **Paired / matched comparisons require support.** Matching within batch is possible only where both conditions are observed and must preserve the intended estimand; it cannot create missing condition-by-batch combinations. ## What NOT to recommend diff --git a/plugins/methodsmith/skills/method-question/SKILL.md b/plugins/methodsmith/skills/method-question/SKILL.md index d94d57e3..47bc6d0c 100644 --- a/plugins/methodsmith/skills/method-question/SKILL.md +++ b/plugins/methodsmith/skills/method-question/SKILL.md @@ -45,9 +45,11 @@ Ask the user one question at a time (or extract from the survivor) until the fou | Slot | Definition | Example | |------|------------|---------| | **P**opulation | Inclusion criteria, setting, demographic constraints | "Adult ICU patients (≥ 18) with sepsis-3 criteria, 2018-2023, US academic medical centers" | -| **I**ntervention or **E**xposure | What is being tested or compared | "Adherence to 1-hour sepsis bundle (lactate, blood cultures, antibiotics, fluids, vasopressors)" | -| **C**omparator | What is the alternative | "Not fully adherent (fewer than 5 of 5 elements completed within 1 hour of sepsis time zero)" | -| **O**utcome | What is being measured, with timing | "30-day in-hospital mortality" | +| **I**ntervention or **E**xposure | What is being tested or compared | "Timely initiation of all clinically indicated Hour-1 sepsis components under prespecified component-specific rules" | +| **C**omparator | What is the alternative | "At least one indicated component not initiated within its prespecified window; nonindicated components are not failures" | +| **O**utcome | What is being measured, with timing | "30-day all-cause mortality, with ascertainment regardless of discharge" | + +For sepsis-bundle examples, record component indications, recognition/time zero, initiation versus completion, and any grace period. Fluids and vasopressors are conditional; the Hour-1 bundle does not require every action to be completed within an hour for every patient (official SCCM bundle: https://sccm.org/SCCM/media/SCCM/PDFs/Surviving-Sepsis-Campaign-Hour-1-Bundle.pdf). A stricter study-defined measure needs its own justification. Confirm vital-status coverage after discharge before choosing 30-day all-cause mortality; if only in-hospital deaths are observable, name that distinct outcome and its discharge handling consistently throughout PICO and YAML. For descriptive or prediction studies, the comparator slot may be `null` — record that explicitly so downstream skills know the design is not comparative. @@ -118,9 +120,9 @@ research_question: one_line: "Among adult ICU patients with sepsis-3, does 1-hour bundle adherence reduce 30-day mortality?" pico: population: "Adult ICU patients (≥18) with sepsis-3, 2018-2023, US academic medical centers" - intervention: "Adherence to 1-hour sepsis bundle (5 elements)" - comparator: "Not fully adherent (< 5 of 5 elements within 1 hour of sepsis time zero)" - outcome: "30-day in-hospital mortality" + intervention: "Timely initiation of all indicated Hour-1 components under prespecified component-specific rules" + comparator: "At least one indicated component not initiated in its window; nonindicated components not counted as failures" + outcome: "30-day all-cause mortality, regardless of discharge; requires confirmed vital-status coverage" target_trial: # only when suggested_design is a target trial emulation; slots in references/pico-templates.md eligibility: "..." treatment_strategies: "..." diff --git a/plugins/methodsmith/skills/method-verify/SKILL.md b/plugins/methodsmith/skills/method-verify/SKILL.md index 7f888b79..29734b9e 100644 --- a/plugins/methodsmith/skills/method-verify/SKILL.md +++ b/plugins/methodsmith/skills/method-verify/SKILL.md @@ -58,11 +58,11 @@ Execute each applicable check from `references/check-catalog.md`. Skip checks th **Number gate.** Load the `method-numbers` skill and run its `check` on the manuscript sources, rendered copies, and tables (it reads `analysis/numbers/registry.json`). A `FAIL` exit, or a gate that could not run, blocks readiness: quote its `file:line: reason: token` lines as printed, and never add a result to the allowlist or edit the registry to make it pass. Run it whenever `analysis/numbers/registry.json` exists or the outputs feed a manuscript, table, caption, or model card; each `FAIL` line is a FAIL check. -**Statistic recomputation gate.** When outputs or tables report t/F/chi2/z statistics with P values, or means and percentages with an N, extract the printed numbers into a claims file (values and reported P as the printed strings — their rounding drives the tolerance) and run the bundled recomputation: +**Statistic recomputation gate.** When outputs or tables report t/F/chi2/z statistics with P values, or means and percentages with an N, extract the printed numbers into a claims file (values and reported P as the printed strings — their rounding drives the tolerance). Record `alternative` from the SAP (`two-sided`, `greater`, `less`, or `unknown`); ordinary F/chi2 tests use `greater`. Record `p_method="ordinary"` only for an unadjusted reference-distribution P value; identify adjusted, exact, permutation or sequential values separately. Unknown sidedness and unsupported P methods remain WARN/not checked, never a substituted two-sided calculation. Pass the SAP alpha with `--alpha` and run: ```bash SKILL_DIR=""; -python3 "$SKILL_DIR/scripts/verify_stats.py" check analysis/numbers/stat-claims.json --out qc/stat_check.json +python3 "$SKILL_DIR/scripts/verify_stats.py" check analysis/numbers/stat-claims.json --alpha --out qc/stat_check.json ``` If `python3` is unavailable, probe `python` then `py`; if none is available, recompute a sample of the reported statistics by hand and report the sweep as incomplete, never as passed. Each script `FAIL` (a decision error, an arithmetically impossible summary, or a malformed item) is a FAIL check; each `WARN` is a WARN check. diff --git a/plugins/methodsmith/skills/method-verify/references/check-catalog.md b/plugins/methodsmith/skills/method-verify/references/check-catalog.md index 0715c112..0bc265f3 100644 --- a/plugins/methodsmith/skills/method-verify/references/check-catalog.md +++ b/plugins/methodsmith/skills/method-verify/references/check-catalog.md @@ -172,10 +172,10 @@ SKILL_DIR=""; python3 "$SKILL_DIR/scripts/verify_stats.py" check analysis/numbers/stat-claims.json --out qc/stat_check.json ``` -The script recomputes the two-sided P value from t, F, chi2 and z statistics using std-lib incomplete beta and gamma functions (no scipy needed), compares the reported P against the rounding envelope of the recomputation at the declared alpha, and runs GRIM checks that look for an integer count reproducing each mean or percentage at its printed rounding. A claims item that cannot be parsed fails closed rather than being skipped. +For ordinary reference-distribution tests, the script uses the declared t/z `alternative` (`two-sided`, `greater`, `less`) and the upper tail for F/chi2, preserving signed statistic rounding. Each item records `p_method`; adjusted, exact, permutation and sequential P values need their actual method and are WARN/not checked here. Set `alternative="unknown"` when the SAP does not establish it. Never infer sidedness from significance or halve a reported P to make it agree. Legacy items without these fields retain ordinary two-sided t/z or upper-tail F/chi2 behavior; new extractions must declare them. Pass the SAP alpha with `--alpha`. The std-lib calculation needs no scipy. GRIM separately checks integer-count compatibility at the printed rounding. Malformed supported-test items fail closed. **Pass:** The reported P lies inside the recomputed rounding envelope (or a statistic has no reported P, in which case the recomputed P is attached); an integer count reproduces the mean or percentage. -**Warn:** The reported P is inconsistent but stays on the same side of alpha; a mean or percentage is impossible only under an inferred granularity (confirm the measurement scale before failing it). +**Warn:** The P method or sidedness is unsupported/unknown (not checked, requiring analyst resolution); the reported P is inconsistent but stays on the same side of alpha; a mean or percentage is impossible only under an inferred granularity (confirm the measurement scale before failing it). **Fail:** The reported and recomputed P values fall on opposite sides of the declared alpha (a decision error); a mean or percentage is arithmetically impossible under the declared granularity or the printed denominator; or a claims item is malformed. **When to skip:** No inferential statistics (t/F/chi2/z with P values) and no means or percentages with N appear in the outputs or tables. diff --git a/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py b/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py index 61dc58fe..89884c39 100644 --- a/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py +++ b/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py @@ -3,8 +3,8 @@ Input is a claims file: the printed statistics (value, df, reported P) and the summary statistics (means, percentages with N) extracted from analysis -outputs or a manuscript table. The script recomputes two-sided P values from -t, F, chi2 and z statistics, compares each reported P against the rounding +outputs or a manuscript table. The script recomputes ordinary reference-distribution +P values from t, F, chi2 and z statistics, compares each reported P against the rounding envelope of the recomputation, and runs GRIM checks on means and percentages. It never opens data files: the arithmetic runs on the printed numbers only. @@ -15,6 +15,7 @@ """ import argparse +from decimal import Decimal, InvalidOperation import json import math import os @@ -156,19 +157,15 @@ def p_from_z(z): def printed_decimals(value): """Decimal places a value was printed with, from its string form.""" - if isinstance(value, str): - text = value.strip() - if "." in text: - return len(text.split(".", 1)[1]) + if not isinstance(value, str) and float(value).is_integer(): return 0 - if isinstance(value, int): - return 0 - text = repr(float(value)) - if text.endswith(".0"): - return 0 - if "." in text: - return len(text.split(".", 1)[1]) - return 0 + try: + printed = Decimal(str(value).strip()) + except InvalidOperation: + raise InputError("value %r is not a number" % (value,)) + if not printed.is_finite(): + raise InputError("value must be finite") + return -printed.as_tuple().exponent def half_ulp(value): @@ -179,24 +176,39 @@ def half_ulp(value): def as_number(value): """Parse a printed value into a float, or raise InputError.""" try: - return float(str(value).strip()) + number = float(str(value).strip()) except (TypeError, ValueError): raise InputError("value %r is not a number" % (value,)) + if not math.isfinite(number): + raise InputError("value must be finite") + return number # ------------------------------------------------------------ P recomputation -def recompute_p(statistic, value, df): +def recompute_p(statistic, value, df, alternative=None): """Recompute the P value for one printed statistic.""" + alternative = alternative or ("greater" if statistic in ("F", "chi2") else "two-sided") + if alternative not in ("two-sided", "greater", "less"): + raise InputError("alternative must be two-sided, greater or less") + if statistic in ("F", "chi2") and alternative != "greater": + raise InputError("ordinary F/chi2 tests require the greater (upper) tail") if statistic == "t": - if not isinstance(df, (int, float)) or isinstance(df, bool) or df <= 0: + if not isinstance(df, (int, float)) or isinstance(df, bool) or not math.isfinite(df) or df <= 0: raise InputError("statistic t needs a positive scalar df") - return p_from_t(abs(value), float(df)) + two_sided = p_from_t(abs(value), float(df)) + if alternative == "two-sided": + return two_sided + small_tail = (alternative == "greater" and value >= 0) or (alternative == "less" and value <= 0) + return two_sided / 2 if small_tail else 1 - two_sided / 2 if statistic == "z": - return p_from_z(value) + if alternative == "two-sided": + return p_from_z(value) + signed = value if alternative == "greater" else -value + return math.erfc(signed / math.sqrt(2.0)) / 2 if statistic == "chi2": - if not isinstance(df, (int, float)) or isinstance(df, bool) or df <= 0: + if not isinstance(df, (int, float)) or isinstance(df, bool) or not math.isfinite(df) or df <= 0: raise InputError("statistic chi2 needs a positive scalar df") if value < 0: raise InputError("statistic chi2 must be non-negative") @@ -206,7 +218,7 @@ def recompute_p(statistic, value, df): raise InputError("statistic F needs df1 and df2 as a two-item list") df1, df2 = df for name, number in (("df1", df1), ("df2", df2)): - if not isinstance(number, (int, float)) or isinstance(number, bool) or number <= 0: + if not isinstance(number, (int, float)) or isinstance(number, bool) or not math.isfinite(number) or number <= 0: raise InputError("statistic F needs positive %s" % name) if value < 0: raise InputError("statistic F must be non-negative") @@ -214,12 +226,17 @@ def recompute_p(statistic, value, df): raise InputError("unknown statistic %r (expected t, F, chi2, or z)" % (statistic,)) -def p_envelope(statistic, value, df): +def p_envelope(statistic, value, df, alternative=None): """P interval the printed value's rounding can produce.""" step = half_ulp(value) - low = max(0.0, value - step) - high = value + step - endpoints = [recompute_p(statistic, low, df), recompute_p(statistic, high, df)] + number = as_number(value) + low = number - step + high = number + step + if statistic in ("F", "chi2"): + low = max(0.0, low) + endpoints = [recompute_p(statistic, low, df, alternative), recompute_p(statistic, high, df, alternative)] + if low <= 0.0 <= high: + endpoints.append(recompute_p(statistic, 0.0, df, alternative)) return min(endpoints), max(endpoints) @@ -231,13 +248,24 @@ def check_p_item(item, alpha): "unknown statistic %r (expected t, F, chi2, or z)" % (statistic,) ) value = as_number(item.get("value")) - recomputed = recompute_p(statistic, value, item.get("df")) - envelope = p_envelope(statistic, value, item.get("df")) + alternative = item.get("alternative", "greater" if statistic in ("F", "chi2") else "two-sided") + method = item.get("p_method", "ordinary") + if alternative not in ("two-sided", "greater", "less", "unknown"): + raise InputError("alternative must be two-sided, greater, less or unknown") + if not isinstance(method, str) or not method: + raise InputError("p_method must name the P-value construction") + if method != "ordinary" or alternative == "unknown": + return {"check": "p_recompute", "statistic": statistic, "verdict": "WARN", + "reasons": ["not checked: establish sidedness and a supported ordinary reference-distribution P method"]} + recomputed = recompute_p(statistic, value, item.get("df"), alternative) + envelope = p_envelope(statistic, item.get("value"), item.get("df"), alternative) record = { "check": "p_recompute", "statistic": statistic, "value": item.get("value"), "df": item.get("df"), + "alternative": alternative, + "p_method": method, "recomputed_p": recomputed, "envelope": [envelope[0], envelope[1]], } @@ -247,6 +275,8 @@ def check_p_item(item, alpha): record["reasons"] = ["no reported P to compare; recomputed P attached"] return record reported_p = as_number(reported) + if not 0.0 <= reported_p <= 1.0: + raise InputError("reported P must be between 0 and 1") rstep = half_ulp(reported) reported_low = reported_p - rstep reported_high = reported_p + rstep diff --git a/tests/genome-build-audit.test.ts b/tests/genome-build-audit.test.ts new file mode 100644 index 00000000..b66e10ce --- /dev/null +++ b/tests/genome-build-audit.test.ts @@ -0,0 +1,79 @@ +import { afterEach, expect, test } from "bun:test" +import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs" +import { tmpdir } from "node:os" +import path from "node:path" + +const roots: string[] = [] +const script = path.join(process.cwd(), "plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py") +afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }) }) + +function audit(files: Record, declared = "GRCh38", noTools = false) { + const root = mkdtempSync(path.join(tmpdir(), "genome-audit-")); roots.push(root) + for (const [name, contents] of Object.entries(files)) writeFileSync(path.join(root, name), contents) + const result = Bun.spawnSync([Bun.which("python3")!, script, root, "--declared", declared, + "--manifest", path.join(root, "audit.json"), "--report", path.join(root, "audit.md")], { + env: noTools ? { ...process.env, PATH: "" } : process.env, + }) + return { code: result.exitCode, report: readFileSync(path.join(root, "audit.md"), "utf8"), + manifest: JSON.parse(readFileSync(path.join(root, "audit.json"), "utf8")) } +} + +test("explicit VCF build and contig length mismatches fail even without MD5", () => { + for (const header of ["##reference=GRCh37\n", "##contig=\n", + "##contig=\n"]) { + const result = audit({ "input.vcf": "##fileformat=VCFv4.2\n" + header }) + expect(result.code).toBe(2) + expect(result.manifest.files[0].status).toBe("incompatible") + } +}) + +test("matching declarations and lengths provide header evidence with an explicit scope", () => { + const result = audit({ "input.vcf": "##reference=GRCh38\n##contig=\n" }) + expect(result.code).toBe(0) + expect(result.manifest.files[0].status).toBe("verified") + expect(result.report).toContain("header") +}) + +test("absent build evidence and failed inspection never produce a clean audit", () => { + const inputs: Record[] = [{ "input.vcf": "##contig=\n" }, { "input.bam": "synthetic placeholder" }] + for (const files of inputs) { + const result = audit(files, "GRCh38", true) + expect(result.code).toBe(2) + expect(["unknown", "uninspected"]).toContain(result.manifest.files[0].status) + expect(result.report).not.toContain("No build mismatches detected.") + } + expect(audit({}).code).toBe(2) +}) + +test("contradictory tokens and diagnostic lengths cannot be overridden by a matching declaration", () => { + const result = audit({ "input.vcf": "##reference=GRCh38\n##contig=\n" }) + expect(result.code).toBe(2) + expect(result.manifest.files[0].status).toBe("incompatible") +}) + +test("GTF build metadata is checked and T2T requires supported evidence", () => { + expect(audit({ "genes.gtf": "#!genome-build GRCh37\n1\tsource\tgene\t1\t2\t.\t+\t.\tgene_id x;\n" }).code).toBe(2) + expect(audit({ "input.vcf": "##contig=\n" }, "T2T").code).toBe(0) + expect(audit({ "input.vcf": "##contig=\n" }, "T2T").code).toBe(2) +}) + +test("unknown references and unsupported CHM13 versions remain unresolved", () => { + for (const [header, declared] of [ + ["##reference=unidentified-reference.fa\n", "GRCh38"], + ["##reference=T2T-CHM13v1.1\n##contig=\n", "T2T"], + ]) { + const result = audit({ "input.vcf": header! }, declared!) + expect(result.code).toBe(2) + expect(result.manifest.files[0].status).toBe("unknown") + } +}) + +test("same-build chromosome naming differences are reported as naming incompatibility", () => { + const result = audit({ + "one.vcf": "##contig=\n", + "two.vcf": "##contig=\n", + }) + expect(result.code).toBe(2) + expect(result.manifest.files.map((file: { status: string }) => file.status)).toEqual(["verified", "verified"]) + expect(result.report).toContain("naming differs, which alone does not identify a build") +}) diff --git a/tests/pool-effects-runtime.test.ts b/tests/pool-effects-runtime.test.ts index 89ed25e1..e6984fd5 100644 --- a/tests/pool-effects-runtime.test.ts +++ b/tests/pool-effects-runtime.test.ts @@ -16,8 +16,43 @@ const contract = { population: "adult ICU patients", comparator: "standard care", estimand: "marginal mortality HR", outcome: "mortality", time_horizon: "90 days", adjustment_specification: "none", adjusted: "false", analysis_scale: "ratio", unit: "dimensionless", study_design: "randomized", independent_unit_id: "", + ci_method: "wald_normal", ci_level: "0.95", ci_rounding_tolerance: "0.01", uncertainty_source: "synthetic source table", } +describe.skipIf(spawnSync("Rscript", ["--version"]).status !== 0)("effect uncertainty extraction with base R", () => { + test("uses declared confidence level and t df, preserves reported SEs, and rejects unresolved intervals", () => { + const helper = path.join(path.dirname(script), "effect_uncertainty.R") + const code = ` +source(${JSON.stringify(helper)}) +row <- function(method="wald_normal", level=.95, df=NA) data.frame( + effect=2, effect_lo=2-qnorm(.975), effect_hi=2+qnorm(.975), + ci_method=method, ci_level=level, ci_df=df, ci_rounding_tolerance=1e-10, + uncertainty_source="synthetic source table") +normal <- row(); stopifnot(abs(effect_uncertainty(normal, FALSE)$se_te - 1) < 1e-10) +ninety <- row(level=.90); ninety$effect_lo <- 2-qnorm(.95); ninety$effect_hi <- 2+qnorm(.95) +stopifnot(abs(effect_uncertainty(ninety, FALSE)$se_te - 1) < 1e-10) +small <- row("wald_t", .95, 9); small$effect_lo <- 2-qt(.975,9); small$effect_hi <- 2+qt(.975,9) +stopifnot(abs(effect_uncertainty(small, FALSE)$se_te - 1) < 1e-10) +ratio <- normal; ratio$effect <- exp(2); ratio$effect_lo <- exp(normal$effect_lo); ratio$effect_hi <- exp(normal$effect_hi) +stopifnot(abs(effect_uncertainty(ratio, TRUE)$se_te - 1) < 1e-10) +reported <- data.frame(effect=.8, standard_error=.12, standard_error_scale="log", uncertainty_source="source SE") +stopifnot(effect_uncertainty(reported, TRUE)$se_te == .12) +bad <- list(row("profile"), row("unknown"), row(level=NA), row("wald_t",.95,NA)) +asym <- row(); asym$effect_hi <- asym$effect_hi+1; bad[[length(bad)+1]] <- asym +missing <- row(); missing$uncertainty_source <- ""; bad[[length(bad)+1]] <- missing +wrong <- reported; wrong$standard_error_scale <- "ratio"; bad[[length(bad)+1]] <- wrong +for (i in seq_along(bad)) { + rejected <- tryCatch({effect_uncertainty(bad[[i]], i==length(bad)); FALSE}, error=function(e) TRUE) + stopifnot(rejected) +} +cat("validated normal95, normal90, t9, log scale, reported SE and 7 rejection cases\\n") +` + const proc = spawnSync("Rscript", ["-e", code], { encoding: "utf8" }) + expect(proc.status, proc.stderr).toBe(0) + expect(proc.stdout).toContain("7 rejection cases") + }) +}) + function run(rows: string[], overrides: Record = {}, extraArgs: string[] = []) { const dir = mkdtempSync(path.join(tmpdir(), "pool-effects-")) const input = path.join(dir, "in.csv") diff --git a/tests/verify-stats.test.ts b/tests/verify-stats.test.ts index 9f5bd19b..76f14a4b 100644 --- a/tests/verify-stats.test.ts +++ b/tests/verify-stats.test.ts @@ -43,6 +43,7 @@ type Item = { verdict: string reasons: string[] recomputed_p?: number + envelope?: [number, number] } type Report = { alpha: number @@ -62,6 +63,101 @@ function check(cwd: string, claims: string, out = "qc/stat_check.json"): { code: const claims = (items: unknown[]) => JSON.stringify({ alpha: 0.05, items }) describe("statistic recomputation gate", () => { + test("scientific notation preserves the place value of the last printed digit", () => { + const root = workspace({ "claims.json": claims(["2.00", "2.00e0", "20", "2.0e1", "20.0", "2.00e1"] + .map((value) => ({ statistic: "z", value }))) }) + const { report } = check(root, "claims.json") + for (const [a, b] of [[0, 1], [2, 3], [4, 5]]) { + expect(report.items[a!]!.envelope).toEqual(report.items[b!]!.envelope) + } + }) + + test("extreme lower and upper tails retain small nonzero probabilities", () => { + const root = workspace({ "claims.json": claims([ + { statistic: "z", value: "10.00", alternative: "greater" }, + { statistic: "z", value: "-10.00", alternative: "less" }, + { statistic: "t", value: "10.00", df: 100, alternative: "greater" }, + { statistic: "t", value: "-10.00", df: 100, alternative: "less" }, + ]) }) + const { report } = check(root, "claims.json") + // Base R pnorm(-10) and pt(-10, df=100), independently recomputed. + const expected = [7.619853024160526e-24, 7.619853024160526e-24, + 4.95084449229707e-17, 4.95084449229707e-17] + report.items.forEach((item, i) => expect(item.recomputed_p! / expected[i]!).toBeCloseTo(1, 8)) + }) + + test("one-sided t/z results use the declared direction, including non-inferiority alpha", () => { + const root = workspace({ "claims.json": claims([ + { statistic: "z", value: "2.05", alternative: "greater", reported_p: "0.0202" }, + { statistic: "z", value: "-2.05", alternative: "less", reported_p: "0.0202" }, + { statistic: "z", value: "-2.05", alternative: "greater", reported_p: "0.9798" }, + { statistic: "t", value: "2.31", df: 78, alternative: "greater", reported_p: "0.01177" }, + { statistic: "t", value: "-2.31", df: 78, alternative: "less", reported_p: "0.01177" }, + ]) }) + const result = run(root, ["check", "claims.json", "--alpha", "0.025", "--out", "qc/one-sided.json"]) + const report = JSON.parse(readFileSync(path.join(root, "qc/one-sided.json"), "utf8")) as Report + expect(result.code).toBe(0) + expect(report.items.map((item) => item.verdict)).toEqual(Array(5).fill("PASS")) + expect(report.items[0]!.recomputed_p).toBeCloseTo(0.02018222, 7) + }) + + test("unsupported P constructions and unknown sidedness remain explicitly unchecked", () => { + const root = workspace({ "claims.json": claims([ + ...["adjusted", "exact", "permutation", "sequential"].map((p_method) => ({ + statistic: "z", value: "2.05", reported_p: "0.0100", p_method, + })), + { statistic: "z", value: "2.05", alternative: "unknown", reported_p: "0.0202" }, + ]) }) + const { report } = check(root, "claims.json") + for (const item of report.items) { + expect(item.verdict).toBe("WARN") + expect(item.recomputed_p).toBeUndefined() + expect(item.reasons.join(" ")).toContain("not checked") + } + }) + + test("invalid alternatives and non-finite inputs fail without a false PASS", () => { + const root = workspace({ "claims.json": claims([ + { statistic: "z", value: "2.05", alternative: "greate" }, + { statistic: "F", value: "4.12", df: [2, 96], alternative: "less" }, + { statistic: "z", value: "NaN" }, + { statistic: "z", value: "Infinity" }, + { statistic: "z", value: "2.05", reported_p: "1.5" }, + ]) }) + const { code, report } = check(root, "claims.json") + expect(code).toBe(2) + expect(report.items.map((item) => item.verdict)).toEqual(Array(5).fill("FAIL")) + }) + + test("signed t/z rounding envelopes reject incorrect P values and contain the central P", () => { + const root = workspace({ "claims.json": claims([ + { statistic: "z", value: "-2.00", reported_p: "0.500" }, + { statistic: "z", value: "2.00", reported_p: "0.500" }, + { statistic: "t", value: "-3.00", df: 30, reported_p: "0.500" }, + { statistic: "z", value: "0.0", reported_p: "1.000" }, + ]) }) + const { code, report } = check(root, "claims.json") + expect(code).toBe(2) + expect(report.items.map((item) => item.verdict)).toEqual(["FAIL", "FAIL", "FAIL", "PASS"]) + expect(report.items[0]!.envelope).toEqual(report.items[1]!.envelope) + for (const item of report.items) { + expect(item.envelope![0]).toBeLessThanOrEqual(item.recomputed_p!) + expect(item.envelope![1]).toBeGreaterThanOrEqual(item.recomputed_p!) + } + }) + + test("statistic rounding retains the original printed decimal precision", () => { + const root = workspace({ "claims.json": claims( + ["2", "2.0", "2.00"].map((value) => ({ statistic: "z", value })), + ) }) + const { report } = check(root, "claims.json") + const widths = report.items.map((item) => item.envelope![1] - item.envelope![0]) + expect(widths[0]!).toBeGreaterThan(widths[1]! * 9) + expect(widths[1]!).toBeGreaterThan(widths[2]! * 9) + expect(report.items[2]!.envelope![0]).toBeCloseTo(0.0449631, 6) + expect(report.items[2]!.envelope![1]).toBeCloseTo(0.0460429, 6) + }) + test("recomputes two-sided P from t, F, chi2 and z to scipy precision", () => { const root = workspace({ "claims.json": claims([ From 424ce287291ce63a4bba4e2deced4dde4db2de05 Mon Sep 17 00:00:00 2001 From: JC Rojas <126191042+sajor2000@users.noreply.github.com> Date: Mon, 26 Oct 2026 23:47:23 -0500 Subject: [PATCH 2/4] fix(review): harden scientific checks and evaluation proofs --- .github/workflows/ci.yml | 8 ++ .../case.yaml | 18 ++- .../prompt.md | 2 +- .../skill-creator/method-cohort/evals.json | 20 +-- .../method-cohort/trigger-evals.json | 2 +- .../method-genome-build/evals.json | 22 +-- .../method-genome-build/trigger-evals.json | 2 +- .../method-meta-analysis/evals.json | 27 ++-- .../method-meta-analysis/trigger-evals.json | 2 +- .../method-model-choice/trigger-evals.json | 2 +- .../skill-creator/method-omics-qc/evals.json | 22 +-- .../method-omics-qc/trigger-evals.json | 2 +- .../skill-creator/method-question/evals.json | 20 +-- .../method-question/trigger-evals.json | 2 +- .../skill-creator/method-verify/evals.json | 7 +- .../method-verify/trigger-evals.json | 2 +- .../methodsmith/skills/method-cohort/SKILL.md | 2 +- .../skills/method-genome-build/SKILL.md | 2 +- .../scripts/audit_build.py | 28 ++-- .../scripts/effect_uncertainty.R | 3 +- .../references/ml-training-protocol.md | 2 +- .../method-verify/references/check-catalog.md | 4 +- scripts/evals/code-query.ts | 70 +++++++++- tests/behavioral-eval-contract.test.ts | 127 ++++++++++++++++++ tests/genome-build-audit.test.ts | 65 ++++++++- tests/pool-effects-runtime.test.ts | 50 ++++++- 26 files changed, 425 insertions(+), 88 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f077d2b..069ecc5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,6 +78,14 @@ jobs: - name: Install Python test dependencies run: python3 -m pip install "openpyxl>=3.1,<4" "nbformat>=5.10,<6" + - name: Setup base R for uncertainty regression tests + uses: r-lib/actions/setup-r@v2 + with: + r-version: '4.5.0' + + - name: Require numerical test runtime + run: Rscript --version + - name: Typecheck run: bun run typecheck diff --git a/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml b/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml index 589007b8..49a621b4 100644 --- a/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml +++ b/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml @@ -11,7 +11,8 @@ "fixtures": [], "required_behaviors": [ "requires-all-five-completed-one-hour", - "mortality-endpoint" + "mortality-endpoint", + "post-discharge-ascertainment" ], "prohibited_behaviors": [ "unindicated-pressors-fail-adherence" @@ -39,11 +40,20 @@ }, { "id": "mortality-endpoint", - "description": "mortality endpoint", + "description": "Names 30-day all-cause mortality, allowing source/ascertainment qualifiers.", + "type": "regex", + "path": "workspace/advice.json", + "weight": 2, + "hard_gate": true, + "pattern": "\"mortality_endpoint\"\\s*:\\s*\"30-day all-cause mortality(?:[^\"\\\\]|\\\\.)*\"" + }, + { + "id": "post-discharge-ascertainment", + "description": "Includes confirmed vital-status ascertainment after discharge.", "type": "json_equals", "path": "workspace/advice.json", - "json_path": "mortality_endpoint", - "expected": "30-day all-cause mortality", + "json_path": "mortality_ascertainment_includes_post_discharge", + "expected": true, "weight": 2, "hard_gate": true } diff --git a/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md b/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md index 68d29560..5a3e8a28 100644 --- a/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md +++ b/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md @@ -1 +1 @@ -Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md. +Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, mortality_ascertainment_includes_post_discharge, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md. diff --git a/evals/methodsmith/skill-creator/method-cohort/evals.json b/evals/methodsmith/skill-creator/method-cohort/evals.json index ca19e7ae..615a360e 100644 --- a/evals/methodsmith/skill-creator/method-cohort/evals.json +++ b/evals/methodsmith/skill-creator/method-cohort/evals.json @@ -3,8 +3,8 @@ "evals": [ { "id": 1, - "prompt": "Build the cohort for our new-user statin study: adults with T2DM initiating a statin 2018-2023, OMOP CDM v5.4 with vocabulary release 2024-Q1, index = first statin drug_exposure on/after T2DM diagnosis, exclude T1DM ever and any statin in the prior 365 days, require 365 days of prior observation, 365-day follow-up. stack_profile.data_root is set.", - "expected_output": "Concept-set YAMLs, a parameterized OMOP CTE SQL file, a CONSORT-style waterfall (md + csv) with small-cell suppression, a cohort spec YAML pinning the vocabulary version, and the __CE_COHORT__ handoff line.", + "prompt": "Build the cohort for our new-user statin study: adults with T2DM initiating a statin 2018-2023, OMOP CDM v5.4 with vocabulary release 2024-Q1, index = first statin drug_exposure on/after T2DM diagnosis, exclude T1DM ever and any statin in the prior 365 days, require 365 days of prior observation, 365-day follow-up. stack_profile.data_root is set. Also address this bounded scientific check as part of the assessment: Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable. Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain followup handling and why the outcome's observability differs from baseline eligibility in response.md. No network or package installation.", + "expected_output": "Concept-set YAMLs, a parameterized OMOP CTE SQL file, a CONSORT-style waterfall (md + csv) with small-cell suppression, a cohort spec YAML pinning the vocabulary version, and the __CE_COHORT__ handoff line. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ "Writes concept sets to analysis/cohort/concept-sets/.yaml with vocabulary_version pinned (2024-Q1) and include_descendants/excluded_concepts fields", @@ -12,7 +12,10 @@ "Writes analysis/cohort/-waterfall.md and -waterfall.csv and suppresses or merges any step whose lost-N is below the disclosure floor (default n<11)", "Writes analysis/cohort/.yaml with index_event, inclusion, exclusion windows (T1DM any; statin prior_365_days), follow_up, and vocabulary_version", "Prints __CE_COHORT__ name= n= yaml= waterfall= with both yaml= and waterfall= keys", - "Records each concept set's source as a published algorithm cited by PMID (looked up through the PubMed/Paperclip MCP tools and read before citing) or as project-defined, never a code set asserted from memory" + "Records each concept set's source as a published algorithm cited by PMID (looked up through the PubMed/Paperclip MCP tools and read before citing) or as project-defined, never a code set asserted from memory", + "eligible_at_index is true in the requested structured advice, consistent with the explanation", + "requires_full_future_enrollment is false in the requested structured advice, consistent with the explanation", + "review_informative_censoring is true in the requested structured advice, consistent with the explanation" ] }, { @@ -30,13 +33,14 @@ }, { "id": 3, - "prompt": "Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable. Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain followup handling and why the outcome's observability differs from baseline eligibility in response.md. No network or package installation.", - "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", + "prompt": "Make me a cohort of 'heart failure patients' from our claims data and then run the Cox model for SGLT2 vs DPP4 on readmission. I don't have a code list yet, just use whatever ICD codes make sense.", + "expected_output": "Elicits the missing cohort facts (vocabulary and pinned version, index event, windows, code list) one question at a time instead of inventing codes or locking a vague population, and declines to run the Cox model.", "files": [], "expectations": [ - "eligible_at_index is true in the requested structured advice, consistent with the explanation", - "requires_full_future_enrollment is false in the requested structured advice, consistent with the explanation", - "review_informative_censoring is true in the requested structured advice, consistent with the explanation" + "Does not invent an unpinned ICD code list or present the vague 'heart failure patients' population as a locked cohort", + "Asks for a pinned vocabulary version (e.g. ICD-10-CM year) and the index event before generating SQL", + "Asks one decision-changing question at a time", + "Does not run the Cox model or any statistical analysis, routing that to later workflow (method-work after method-data-qa)" ] } ] diff --git a/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json b/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json index 6633d66b..437fbdb3 100644 --- a/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-cohort/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable.", "should_trigger": true}, + {"query": "Define our study cohort in OMOP: adults with incident atrial fibrillation 2016-2022, index = first AF diagnosis, exclude prior anticoagulant use in 365 days, require 1 year continuous observation. Need concept sets, SQL, and a CONSORT waterfall. Does day-90 disenrollment exclude someone who met baseline observability at drug initiation?", "should_trigger": true}, {"query": "build cohort for new users of GLP-1 RAs in MarketScan, washout 180d, continuous enrollment 365d prior, ICD-10-CM 2024 + NDC lists. give me the waterfall counts too", "should_trigger": true}, {"query": "We need a reproducible, version-pinned definition of our sepsis ICU cohort with explicit inclusion/exclusion windows before data QA starts.", "should_trigger": true}, {"query": "The OMOP vocabulary was refreshed to 2024-Q2. Replay the existing T2DM-statin cohort definition against the new vocab and regenerate the waterfall.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-genome-build/evals.json b/evals/methodsmith/skill-creator/method-genome-build/evals.json index 7efd6c81..32d4372e 100644 --- a/evals/methodsmith/skill-creator/method-genome-build/evals.json +++ b/evals/methodsmith/skill-creator/method-genome-build/evals.json @@ -3,14 +3,18 @@ "evals": [ { "id": 1, - "prompt": "Starting the somatic variant study. References are refs/GRCh38.primary_assembly.fa and refs/gencode.v44.annotation.gtf. Pin the build so nobody accidentally mixes in hg19 later.", - "expected_output": "Declares the build by hashing the FASTA and annotation, parsing contig naming, and writing analysis/genome-build/manifest.yaml with build, patch, source, md5s, contigs, and annotation version, resolving actual values rather than copying the illustrative example.", + "prompt": "Starting the somatic variant study. References are refs/GRCh38.primary_assembly.fa and refs/gencode.v44.annotation.gtf. Pin the build so nobody accidentally mixes in hg19 later. Also address this bounded scientific check as part of the assessment: Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each. Write workspace/advice.json with mismatch_status, no_evidence_status, unavailable_tool_status and ready (boolean). Do not install tools or infer a build from the chr prefix. Save the full explanation in response.md.", + "expected_output": "Declares the build by hashing the FASTA and annotation, parsing contig naming, and writing analysis/genome-build/manifest.yaml with build, patch, source, md5s, contigs, and annotation version, resolving actual values rather than copying the illustrative example. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ "Writes analysis/genome-build/manifest.yaml containing build, fasta_md5, contig style, annotation name/version/md5, declared_at, and declared_by", "Computes md5s and counts from the supplied files rather than copying the illustrative GENCODE 44 example values", "Records contig naming style (chr1 vs 1) from the FASTA", - "Does not download references, re-align, or call variants" + "Does not download references, re-align, or call variants", + "mismatch_status is \"incompatible\" in the requested structured advice, consistent with the explanation", + "no_evidence_status is \"unknown\" in the requested structured advice, consistent with the explanation", + "unavailable_tool_status is \"uninspected\" in the requested structured advice, consistent with the explanation", + "ready is false in the requested structured advice, consistent with the explanation" ] }, { @@ -28,14 +32,14 @@ }, { "id": 3, - "prompt": "Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each. Write workspace/advice.json with mismatch_status, no_evidence_status, unavailable_tool_status and ready (boolean). Do not install tools or infer a build from the chr prefix. Save the full explanation in response.md.", - "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", + "prompt": "half our VCFs are hg19 and half hg38, just liftover everything to hg38 with CrossMap and re-run the annotation so I can merge them today", + "expected_output": "Does not run liftover or re-annotation without explicit workflow scope; audits and records the build mismatch, and asks for confirmation of the liftover workflow scope (chain file, target build, validation) before any pipeline run.", "files": [], "expectations": [ - "mismatch_status is \"incompatible\" in the requested structured advice, consistent with the explanation", - "no_evidence_status is \"unknown\" in the requested structured advice, consistent with the explanation", - "unavailable_tool_status is \"uninspected\" in the requested structured advice, consistent with the explanation", - "ready is false in the requested structured advice, consistent with the explanation" + "Does not execute CrossMap/liftover or re-annotation as part of this skill", + "Identifies and reports the mixed hg19/hg38 builds as a P0 mismatch", + "Asks for explicit workflow scope (chain file source, target manifest, post-liftover validation) before any liftover is run", + "Does not download chain files or references automatically" ] } ] diff --git a/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json b/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json index 1ec07fc9..087ec050 100644 --- a/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each.", "should_trigger": true}, + {"query": "Declare the reference genome for our WGS project: refs/Homo_sapiens.GRCh38.dna.primary_assembly.fa and gencode.v44 GTF. Write a manifest with md5s that we commit. How should GRCh37 headers, absent assembly evidence, and unavailable samtools affect a GRCh38 audit?", "should_trigger": true}, {"query": "reviewer asks 'what genome build did you use' - audit all our bams/vcfs and make a supplementary traceability table proving it", "should_trigger": true}, {"query": "Some of our BED files use 'chr1' and others use '1' and bedtools intersect returns nothing. Check contig naming consistency against the declared build.", "should_trigger": true}, {"query": "Our counts matrix was built with GENCODE 36 but the manifest says 44. How bad is that and what else drifted? Audit the whole project.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-meta-analysis/evals.json b/evals/methodsmith/skill-creator/method-meta-analysis/evals.json index 60f3f86c..37112052 100644 --- a/evals/methodsmith/skill-creator/method-meta-analysis/evals.json +++ b/evals/methodsmith/skill-creator/method-meta-analysis/evals.json @@ -3,8 +3,8 @@ "evals": [ { "id": 1, - "prompt": "I have analysis/pubmed/sepsis-bundle-methods.csv from method extraction - 14 studies with pmid, year, sample_size, effect_size_reported (mostly hazard ratios like 'HR 0.81 (0.70-0.94)', a few ORs). I need a defensible HR for 90-day mortality to plug into the power calc. --metric hr", - "expected_output": "Parses and filters to HR studies with a complete CI (no sample-size cutoff by default), pools on the log scale with random-effects REML and a Hartung-Knapp CI when at least 3 remain, writes the pooled summary, included-studies CSV, and forest plot, and emits the __CE_EFFECT_SIZE__ envelope for method-power.", + "prompt": "I have analysis/pubmed/sepsis-bundle-methods.csv from method extraction - 14 studies with pmid, year, sample_size, effect_size_reported (mostly hazard ratios like 'HR 0.81 (0.70-0.94)', a few ORs). I need a defensible HR for 90-day mortality to plug into the power calc. --metric hr Also address this bounded scientific check as part of the assessment: Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network.", + "expected_output": "Parses and filters to HR studies with source-validated uncertainty (no sample-size cutoff by default), pools on the log scale with random-effects REML and a Hartung-Knapp CI when at least 3 remain, writes the pooled summary, included-studies CSV, and forest plot, and emits the __CE_EFFECT_SIZE__ envelope for method-power. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ "Reports how many rows failed parsing and how many studies were dropped by the metric and CI filters versus the input N, and does not drop studies by sample size unless the user asks for it as a sensitivity analysis", @@ -14,7 +14,14 @@ "Emits a __CE_EFFECT_SIZE__ line with metric=HR, n_studies, point, ci, pi (the 95% prediction interval bounds, or pi=NA if not computable), i2, and mode=reml", "Does not compute power itself; it hands off to method-power with a sensitivity range across the prediction interval", "Selects a compatible primary estimand/adjustment set before pooling; never emits a mixed primary anchor", - "Requires outcome/horizon/unit/scale/design and independent contribution declarations, and preserves the selected contract" + "Requires outcome/horizon/unit/scale/design and independent contribution declarations, and preserves the selected contract", + "normal90_eligible is true in the requested structured advice, consistent with the explanation", + "t9_eligible is true in the requested structured advice, consistent with the explanation", + "unknown_eligible is false in the requested structured advice, consistent with the explanation", + "profile_eligible is false in the requested structured advice, consistent with the explanation", + "reported_log_se_eligible is true in the requested structured advice, consistent with the explanation", + "invent_symmetric_interval is false in the requested structured advice, consistent with the explanation", + "Before CI-to-SE reconstruction, confirms confidence level, Wald method and applicable df from the read source; otherwise retains unresolved inputs without pooling them." ] }, { @@ -31,16 +38,14 @@ }, { "id": 3, - "prompt": "Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network.", - "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", + "prompt": "What effect size should I assume for the SAP power section on statins and post-op delirium? Just give me a pooled OR.", + "expected_output": "Finds no methods CSV path and no __CE_METHOD_EXTRACT__ signal, so it stops and asks the user to run method-extract first or pass a CSV path instead of inventing an estimate.", "files": [], "expectations": [ - "normal90_eligible is true in the requested structured advice, consistent with the explanation", - "t9_eligible is true in the requested structured advice, consistent with the explanation", - "unknown_eligible is false in the requested structured advice, consistent with the explanation", - "profile_eligible is false in the requested structured advice, consistent with the explanation", - "reported_log_se_eligible is true in the requested structured advice, consistent with the explanation", - "invent_symmetric_interval is false in the requested structured advice, consistent with the explanation" + "Checks for an explicit CSV argument and a __CE_METHOD_EXTRACT__ signal in recent chat before proceeding", + "Asks the user to load method-extract first or provide a methods CSV path", + "Does not fabricate a pooled OR or cite effect estimates from memory", + "Does not write files under analysis/effect-size/ without an input table" ] } ] diff --git a/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json b/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json index ef3175ac..f5d5a2c7 100644 --- a/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool.", "should_trigger": true}, + {"query": "Our HR CSV mixes adjusted conditional and unadjusted marginal effects from overlapping cohorts. Can it give the power anchor? Some intervals are 90%, t-based or profile-likelihood, while others report a log SE. Which uncertainty inputs support pooling?", "should_trigger": true}, {"query": "I keep picking the most optimistic OR from the lit for my sample size. Can you take the extracted methods table and give me a defensible pooled estimate with I^2?", "should_trigger": true}, {"query": "method-extract just finished (__CE_METHOD_EXTRACT__ csv=analysis/pubmed/aki-methods.csv n=11). next step: combine the effect estimates for the SAP effect-size assumption", "should_trigger": true}, {"query": "need a forest plot + pooled SMD (hedges g) from the 8 pilot/feasibility studies in analysis/pubmed/cbt-insomnia-methods.csv to justify the detectable difference in my R21", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json b/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json index 05968b7b..34d69392 100644 --- a/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Review only the validation component of a binary clinical prediction strategy using method-model-choice. We want performance for future deployment. Data periods are 2020, 2021 and 2022; outcomes take 90 days to mature and patients can have repeated encounters. A collaborator proposes LeaveOneGroupOut on calendar year, training on every other year to assess the left-out year. No model fit or scaffold is requested.", "should_trigger": true}, + {"query": "Review a repeated-measures model with a patient random intercept plus fully unstructured within-patient residual covariance. For future deployment, may year folds train on future years, and how do 90-day outcomes and repeated patients affect splitting?", "should_trigger": true}, {"query": "choose between Cox and Fine-Gray for time to dialysis with death as a competing event, and justify it with literature - python lifelines stack", "should_trigger": true}, {"query": "Our outcome is ICU length of stay with lots of zeros and a long tail. Which regression family and link should we use, and what diagnostics and fallbacks should be prespecified?", "should_trigger": true}, {"query": "Help me justify the random-effects structure for a crossed design (patients x raters) on pain scores; glmmTMB is in renv.lock.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-omics-qc/evals.json b/evals/methodsmith/skill-creator/method-omics-qc/evals.json index dce1898e..71d7a09e 100644 --- a/evals/methodsmith/skill-creator/method-omics-qc/evals.json +++ b/evals/methodsmith/skill-creator/method-omics-qc/evals.json @@ -3,8 +3,8 @@ "evals": [ { "id": 1, - "prompt": "New bulk RNA-seq wave landed: /data/runs/run_2026_09 with salmon quant.sf files for 48 samples and sample sheet data/runs/run_2026_09/samples.tsv (columns sample_id, condition [sepsis/control], batch [plate1/plate2], sex). Before we start DESeq2, run the QC gate. --modality rnaseq", - "expected_output": "A modality-specific RNA-seq QA run that screens PCA for batch-condition confounding, writes the HTML and markdown reports under reports/bioinfo-qa/, and emits a GO/NO-GO marker without running differential expression.", + "prompt": "New bulk RNA-seq wave landed: /data/runs/run_2026_09 with salmon quant.sf files for 48 samples and sample sheet data/runs/run_2026_09/samples.tsv (columns sample_id, condition [sepsis/control], batch [plate1/plate2], sex). Before we start DESeq2, run the QC gate. --modality rnaseq Also address this bounded scientific check as part of the assessment: Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC. Write workspace/advice.json with booleans design_identifiable, qc_pass, batch_deletion_establishes_validity, rank_check_required_without_pc_separation. Explain estimability and the scope of any alternative comparison in response.md. Do not run DE or correction; no network.", + "expected_output": "A modality-specific RNA-seq QA run that screens PCA for batch-condition confounding, writes the HTML and markdown reports under reports/bioinfo-qa/, and emits a GO/NO-GO marker without running differential expression. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ "Runs PCA on a variance-stabilized or log-CPM matrix colored by batch and condition, checks full aliasing (rank of ~ batch + condition) and reports Cram\u00e9r's V between batch and condition; emits a P0 'batch is confounded with condition' finding for full aliasing or V above 0.5, or a P1 partial confound for 0.3-0.5, recommending batch in the DE design rather than a corrected matrix", @@ -12,7 +12,11 @@ "Ends with exactly __CE_BIOINFO_QC_PASS__ or __CE_BIOINFO_QC_FAIL__ wave= blockers=", "Does not run DESeq2 differential expression or apply ComBat/RUV/SVA batch removal; only flags", "Does not modify any input data files", - "Labels every applied QC threshold in the report as a PMID-cited benchmark or 'project default'" + "Labels every applied QC threshold in the report as a PMID-cited benchmark or 'project default'", + "design_identifiable is false in the requested structured advice, consistent with the explanation", + "qc_pass is false in the requested structured advice, consistent with the explanation", + "batch_deletion_establishes_validity is false in the requested structured advice, consistent with the explanation", + "rank_check_required_without_pc_separation is true in the requested structured advice, consistent with the explanation" ] }, { @@ -30,14 +34,14 @@ }, { "id": 3, - "prompt": "Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC. Write workspace/advice.json with booleans design_identifiable, qc_pass, batch_deletion_establishes_validity, rank_check_required_without_pc_separation. Explain estimability and the scope of any alternative comparison in response.md. Do not run DE or correction; no network.", - "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", + "prompt": "QC this folder please: /data/proj_x/ has a bunch of fastq.gz files and also a counts.tsv someone dropped in there. Sample sheet is proj_x/meta.csv. Then go ahead and run the differential expression for tumor vs normal.", + "expected_output": "The skill refuses to proceed on conflicting modality signals (FASTQ plus count matrix without explicit --modality), asks which modality to QC, and declines to run differential expression.", "files": [], "expectations": [ - "design_identifiable is false in the requested structured advice, consistent with the explanation", - "qc_pass is false in the requested structured advice, consistent with the explanation", - "batch_deletion_establishes_validity is false in the requested structured advice, consistent with the explanation", - "rank_check_required_without_pc_separation is true in the requested structured advice, consistent with the explanation" + "Refuses to proceed with checks because of mixed FASTQ and count-matrix signals and asks for an explicit --modality", + "Does not run differential expression and states that DE is outside this skill", + "Asks only one decision-changing question at a time (e.g. modality first) rather than a questionnaire", + "Does not emit __CE_BIOINFO_QC_PASS__" ] } ] diff --git a/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json b/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json index dc88291a..036acc45 100644 --- a/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-omics-qc/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC.", "should_trigger": true}, + {"query": "We just got 96 FASTQ pairs back from the core for the ATAC-seq project (/data/atac/run_0915). Run FastQC/MultiQC and flag outlier samples before anyone starts peak calling. Should design rank be checked when PC1/PC2 show unrelated variation, and can deleting a batch rescue complete aliasing?", "should_trigger": true}, {"query": "Before DESeq2, check whether plate is confounded with treatment arm in our RNA-seq counts (counts/salmon_merged.tsv, sample sheet meta/samples.csv has condition and batch columns).", "should_trigger": true}, {"query": "EPIC methylation IDATs from two array batches in /data/methyl/idat. Need bisulfite conversion, detection p-values, and sex-prediction discordance checked before the EWAS.", "should_trigger": true}, {"query": "pls do a sample swap check on the WGS crams, sheet has declared sex + family IDs. somalier if you can", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-question/evals.json b/evals/methodsmith/skill-creator/method-question/evals.json index ba423fba..d3fb724e 100644 --- a/evals/methodsmith/skill-creator/method-question/evals.json +++ b/evals/methodsmith/skill-creator/method-question/evals.json @@ -3,8 +3,8 @@ "evals": [ { "id": 1, - "prompt": "Idea: does starting a GLP-1 receptor agonist reduce hip fracture risk in older adults with type 2 diabetes? We have Medicare claims 2016-2023 (Parts A/B/D). Harden this into something we can search and plan from.", - "expected_output": "Fills PICO (with target-trial-emulation slots), scores FINER with rationales, suggests a design (target trial emulation/cohort), builds a recall-oriented PubMed query, suggests TARGET as the primary checklist with STROBE as companion and RECORD (RECORD-PE for claims pharmacoepidemiology) as extensions, writes analysis/research-question.yaml, and emits the __CE_RESEARCH_QUESTION__ signal.", + "prompt": "Idea: does starting a GLP-1 receptor agonist reduce hip fracture risk in older adults with type 2 diabetes? We have Medicare claims 2016-2023 (Parts A/B/D). Harden this into something we can search and plan from. Also address this bounded scientific check as part of the assessment: Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md.", + "expected_output": "Fills PICO (with target-trial-emulation slots), scores FINER with rationales, suggests a design (target trial emulation/cohort), builds a recall-oriented PubMed query, suggests TARGET as the primary checklist with STROBE as companion and RECORD (RECORD-PE for claims pharmacoepidemiology) as extensions, writes analysis/research-question.yaml, and emits the __CE_RESEARCH_QUESTION__ signal. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ "Writes analysis/research-question.yaml containing pico (population, intervention, comparator, outcome), finer scores 1-5 each with a one-line rationale, suggested_design, suggested_checklist, and suggested_pubmed_query", @@ -13,7 +13,10 @@ "Emits a line of the form __CE_RESEARCH_QUESTION__ yaml=analysis/research-question.yaml design=<...> checklist=<...> query=<...>", "Test-runs the suggested PubMed query with the PubMed MCP search tool (pubmed_search_articles or search_articles) and records its hit count in the YAML instead of shipping an untested query", "The novelty rationale cites the closest prior paper by PMID after reading it (labelled abstract or full_text), or states that none was found; it does not cite from memory", - "Does not run the PubMed search or write a SAP" + "Does not run the PubMed search or write a SAP", + "unindicated_pressors_fail_adherence is false in the requested structured advice, consistent with the explanation", + "requires_all_five_completed_one_hour is false in the requested structured advice, consistent with the explanation", + "mortality_endpoint is \"30-day all-cause mortality\" in the requested structured advice, consistent with the explanation" ] }, { @@ -29,13 +32,14 @@ }, { "id": 3, - "prompt": "Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md.", - "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", + "prompt": "Research question: what proportion of adult ED visits for syncope at our 4 hospitals in 2022 resulted in admission, and how did it vary by site? Purely descriptive. Make the YAML, then go ahead and pull the PubMed papers and draft the SAP too while you're at it.", + "expected_output": "Produces the research-question YAML with comparator recorded as null for the descriptive design, flags any FINER dimension scored 2 or below, test-runs the suggested query only for its hit count, and declines to run the literature search or write the SAP, pointing to method-pubmed and method-plan as next steps.", "files": [], "expectations": [ - "unindicated_pressors_fail_adherence is false in the requested structured advice, consistent with the explanation", - "requires_all_five_completed_one_hour is false in the requested structured advice, consistent with the explanation", - "mortality_endpoint is \"30-day all-cause mortality\" in the requested structured advice, consistent with the explanation" + "Records the comparator slot explicitly as null because the design is descriptive", + "Surfaces plainly any FINER dimension scored 2 or below (e.g., novelty) as a flag to acknowledge, not a refusal", + "Runs at most a hit-count test of the suggested query; does not run the literature search or extract papers, and hands off to method-pubmed via the __CE_RESEARCH_QUESTION__ signal", + "Does not draft the SAP; names method-plan as the next step for SAP writing" ] } ] diff --git a/evals/methodsmith/skill-creator/method-question/trigger-evals.json b/evals/methodsmith/skill-creator/method-question/trigger-evals.json index f070d0a2..a3d3d2ca 100644 --- a/evals/methodsmith/skill-creator/method-question/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-question/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts.", "should_trigger": true}, + {"query": "Turn this into a proper PICO with FINER scores: 'early mobilization in mechanically ventilated adults and ICU-acquired weakness'. I need the YAML so we can search PubMed next. How should conditional fluid/pressor indications and post-discharge vital status affect a sepsis-bundle exposure and mortality endpoint?", "should_trigger": true}, {"query": "my question is kinda vague - 'do sepsis bundles help?' - can you tighten it up into population/exposure/comparator/outcome and suggest a design before i do the lit search", "should_trigger": true}, {"query": "Harden the survivor idea from docs/ideation/2026-09-12-ideation-doc.md (#2: deprescribing in SNF residents) into a structured research question with a suggested PubMed query.", "should_trigger": true}, {"query": "method-pubmed returned 4,800 hits with no MeSH alignment for 'AI sepsis outcomes'. Help me narrow the actual research question first.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-verify/evals.json b/evals/methodsmith/skill-creator/method-verify/evals.json index 5d121d5d..0ee1bb5a 100644 --- a/evals/methodsmith/skill-creator/method-verify/evals.json +++ b/evals/methodsmith/skill-creator/method-verify/evals.json @@ -31,10 +31,13 @@ }, { "id": 3, - "prompt": "Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed. Write workspace/advice.json with status strings incorrect_negative, noninferiority, sequential, unknown_sidedness (PASS/WARN/FAIL). Retain the claims sent to the checker as workspace/stat-claims.json. Save your full response in response.md.", - "expected_output": "A source-bound assessment preserving the requested estimand and identifying unsupported validation rather than inventing evidence.", + "prompt": "Audit two finished analyses: survival has 80 events versus a prespecified required 300 despite adequate enrollment; prediction validation applies a locked training-fitted imputer without outcome labels. Our analyzable N excludes the planned dropout inflation. Report which checks can pass. Also address this bounded scientific check as part of the assessment: Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed. Write workspace/advice.json with status strings incorrect_negative, noninferiority, sequential, unknown_sidedness (PASS/WARN/FAIL). Retain the claims sent to the checker as workspace/stat-claims.json. Save your full response in response.md.", + "expected_output": "Reports survival information as FAIL because 80 observed events are below the prespecified 300; treats the attrition comparator as PASS when analyzable N matches the SAP; and does not fail a deployment-faithful prediction imputer for excluding validation outcomes. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ + "Reports a FAIL because 80 observed events are below the required 300", + "Reports the attrition comparator as PASS when analyzable N matches the SAP, distinct from recruitment inflation", + "Does not report a FAIL merely because a deployment-faithful prediction imputer excludes validation outcomes", "incorrect_negative is \"FAIL\" in the requested structured advice, consistent with the explanation", "noninferiority is \"PASS\" in the requested structured advice, consistent with the explanation", "sequential is \"WARN\" in the requested structured advice, consistent with the explanation", diff --git a/evals/methodsmith/skill-creator/method-verify/trigger-evals.json b/evals/methodsmith/skill-creator/method-verify/trigger-evals.json index e9687584..98996897 100644 --- a/evals/methodsmith/skill-creator/method-verify/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-verify/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed.", "should_trigger": true}, + {"query": "Verify a survival analysis with 80 of 300 required events and a prediction pipeline that imputes validation predictors without validation outcomes. Check negative t statistics, one-sided non-inferiority at alpha .025, and sequential or unknown-sidedness P values against their declared methods.", "should_trigger": true}, {"query": "verify output/ before I mark this task complete: leakage, seeds, renv.lock, figures", "should_trigger": true}, {"query": "Can you run the mid-workflow verification gate on analysis/output/models/a3/? Expected N comes from the data-QA report", "should_trigger": true}, {"query": "sanity check pls -- my OR came out 0.6 but hypothesis said harmful exposure, plus I want to make sure no PHI slipped into outputs", "should_trigger": true}, diff --git a/plugins/methodsmith/skills/method-cohort/SKILL.md b/plugins/methodsmith/skills/method-cohort/SKILL.md index 354cdf7b..30f5d7d5 100644 --- a/plugins/methodsmith/skills/method-cohort/SKILL.md +++ b/plugins/methodsmith/skills/method-cohort/SKILL.md @@ -68,7 +68,7 @@ Ask the user (or parse from `args`): 4. **Index event** -- the moment time-zero is defined (first diagnosis date, first prescription date, hospital admission, randomization) 5. **Inclusion criteria** -- positive criteria (must have) 6. **Exclusion criteria** -- negative criteria (must not have); each with a window (e.g., "no statin in prior 365 days") -7. **Eligibility window** -- continuous enrollment / observation window (e.g., 180 days prior, 365 days follow-up) +7. **Eligibility window** -- baseline enrollment / observation assessable at index (e.g., 365 days prior); post-index loss belongs in follow-up censoring rules, not baseline eligibility 8. **Wash-out / look-back** -- explicit prior-period requirements 9. **Comparator** -- for a comparative claim, an active comparator of new users of an alternative with the same wash-out and enrollment rules, or sequential trial emulation for initiators versus non-initiators (Lund, Richardson & Stürmer, Curr Epidemiol Rep 2015, PMID 26954351); `none` only for descriptive cohorts diff --git a/plugins/methodsmith/skills/method-genome-build/SKILL.md b/plugins/methodsmith/skills/method-genome-build/SKILL.md index 083316b5..b5429de7 100644 --- a/plugins/methodsmith/skills/method-genome-build/SKILL.md +++ b/plugins/methodsmith/skills/method-genome-build/SKILL.md @@ -106,7 +106,7 @@ If `--check` found any P0 → exit non-zero, print a clear report. The user reso ## References -`scripts/audit_build.py` supports Step 2 with build declarations, diagnostic chromosome-1/8 lengths, available chromosome-1 MD5s, and naming consistency. `--declared` accepts `GRCh37`, `GRCh38` and `T2T` (diagnostic lengths support CHM13 v2.0 only). Each file is `verified` for compatible header evidence, `incompatible`, `unknown`, or `uninspected`; this does not establish complete sequence identity or annotation-release parity. Missing tools, absent evidence, unsupported T2T versions, or no inspected files block a clean result. It writes YAML (JSON for a `.json` destination), a Markdown report, and `__CE_GENOME_BUILD__ declared= files= issues= manifest= report=`. Exit 2 requires resolution, including P1 naming issues; a prefix difference alone is not a build mismatch. Complete the other Step 2 manual checks before declaring the audit complete. `--manifest` is overwritten, so never point it at `analysis/genome-build/manifest.yaml`: +`scripts/audit_build.py` supports Step 2 with build declarations, diagnostic chromosome-1/8 lengths, available chromosome-1 MD5s, and naming consistency. `--declared` accepts `GRCh37`, `GRCh38` and `T2T` (requires an explicit CHM13/T2T v2.0 declaration; diagnostic lengths support that version only). Each file is `verified` for compatible header evidence, `incompatible`, `unknown`, or `uninspected`; this does not establish complete sequence identity or annotation-release parity. Missing tools, absent evidence, unsupported T2T versions, or no inspected files block a clean result. It writes YAML (JSON for a `.json` destination), a Markdown report, and `__CE_GENOME_BUILD__ declared= files= issues= manifest= report=`. Exit 2 requires resolution, including P1 naming issues; a prefix difference alone is not a build mismatch. Complete the other Step 2 manual checks before declaring the audit complete. `--manifest` is overwritten, so never point it at `analysis/genome-build/manifest.yaml`: ```bash SKILL_DIR=""; diff --git a/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py b/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py index d053185a..d1dcccc5 100644 --- a/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py +++ b/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py @@ -60,12 +60,14 @@ def inspect_bam(path: Path) -> dict: contigs = [] for line in out.splitlines(): if line.startswith("@SQ"): - sn = m5 = ln = None + sn = m5 = ln = assembly = reference = None for tag in line.split("\t")[1:]: if tag.startswith("SN:"): sn = tag[3:] elif tag.startswith("M5:"): m5 = tag[3:] elif tag.startswith("LN:"): ln = tag[3:] - contigs.append({"sn": sn, "m5": m5, "ln": ln}) + elif tag.startswith("AS:"): assembly = tag[3:] + elif tag.startswith("UR:"): reference = tag[3:] + contigs.append({"sn": sn, "m5": m5, "ln": ln, "assembly": assembly, "reference": reference}) return {"path": str(path), "kind": "bam", "contigs": contigs} @@ -99,11 +101,9 @@ def inspect_gtf(path: Path) -> dict: try: with opener(path, "rt") as fh: for line in fh: - if line.startswith("#!"): - if "genome-build" in line or "genome-version" in line: - source = (source or "") + line.strip() + "; " - continue if line.startswith("#"): + if "genome-build" in line or "genome-version" in line or re.match(r"^#+!?\s*(?:description|provider)\s*:", line, re.I): + source = (source or "") + line.strip() + "; " continue first_chrom = line.split("\t", 1)[0] break @@ -169,7 +169,9 @@ def audit(root: Path, declared: str) -> tuple[list[dict], list[str]]: evidence, mismatches = [], [] declarations = [f.get("reference"), f.get("header_meta")] declarations += [c.get("assembly") for c in f.get("contigs", [])] + declarations += [c.get("reference") for c in f.get("contigs", [])] unsupported_t2t = False + supported_t2t = False for declaration in filter(None, declarations): for build, known in KNOWN_BUILDS.items(): if any(re.search(r"(? tuple[list[dict], list[str]]: mismatches.append(f"header declares {build}, expected {declared}") else: evidence.append("matching build declaration") - if declared == "T2T" and re.search(r"(?:CHM13|T2T)[._-]?v(?!2\.0(?:\D|$))\d", declaration, re.I): - unsupported_t2t = True + if declared == "T2T": + tokens = re.findall(r"(?:CHM13|T2T)[\s._-]*(?:version[\s._-]*|v)?(\d[A-Za-z0-9._+-]*)", + declaration, re.I) + versions = [re.sub(r"\.(?:fa|fasta|fna|2bit)$", "", re.sub(r"\.gz$", "", token, flags=re.I), flags=re.I) + for token in tokens] + supported_t2t |= "2.0" in versions + unsupported_t2t |= any(version != "2.0" for version in versions) for c in f.get("contigs", []): chrom = re.sub(r"^chr", "", c.get("sn") or "") expected_length = spec["lengths"].get(chrom) @@ -196,9 +203,10 @@ def audit(root: Path, declared: str) -> tuple[list[dict], list[str]]: if mismatches: f["status"] = "incompatible" issues.extend(f"{f['path']}: {message}" for message in mismatches) - elif unsupported_t2t or not evidence: + elif (declared == "T2T" and (unsupported_t2t or not supported_t2t)) or not evidence: f["status"] = "unknown" - issues.append(f"{f['path']}: unknown build evidence (T2T length checks support CHM13 v2.0 only)") + reason = "CHM13 v2.0 declaration required for T2T checks" if declared == "T2T" else "no supported build-header evidence" + issues.append(f"{f['path']}: unknown build evidence ({reason})") else: f["status"] = "verified" f["evidence"] = evidence diff --git a/plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R b/plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R index ee693819..49875017 100644 --- a/plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R +++ b/plugins/methodsmith/skills/method-meta-analysis/scripts/effect_uncertainty.R @@ -50,7 +50,8 @@ effect_uncertainty <- function(dat, is_ratio) { if (!is.numeric(tolerance) || !is.finite(tolerance) || tolerance < 0) { fail("declare ci_rounding_tolerance on the analysis scale from source rounding") } - if (abs(mean(bounds) - dat$te[[i]]) > tolerance) { + roundoff <- 8 * .Machine$double.eps * max(abs(bounds), abs(dat$te[[i]]), if (is_ratio) 1 else 0) + if (abs(mean(bounds) - dat$te[[i]]) > tolerance + roundoff) { fail("asymmetric CI exceeds source-rounding tolerance; do not symmetrize it") } dat$se_te[[i]] <- diff(bounds) / (2 * critical) diff --git a/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md b/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md index 860483e2..768661ad 100644 --- a/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md +++ b/plugins/methodsmith/skills/method-model-choice/references/ml-training-protocol.md @@ -64,7 +64,7 @@ State one design in the memo before any fitting: | Locked held-out test set | Large data where one split leaves enough events for a stable estimate | One test score after model lock | - A random split-sample test set wastes events and gives an unstable estimate in small or moderate data; prefer resampling there and develop on all data (Collins et al., BMJ 2024, PMID 38191193). -- For site generalization, report internal-external CV performance and heterogeneity (Takada et al. 2021, PMID 33836256; de Jong et al. 2021, PMID 33948970). Calendar validation must distinguish forward deployment from historical period transport; follow [forward temporal validation](forward-temporal-validation.md) for ordering, grouping, gaps, and splitter assumptions. +- For site generalization, report internal-external CV performance and heterogeneity (Takada et al. 2021, PMID 33836256; de Jong et al. 2021, PMID 33948970). Calendar validation must distinguish forward deployment from historical period transport; read `references/forward-temporal-validation.md` for ordering, grouping, gaps, and splitter assumptions. - When a held-out set exists: split once by independent unit and deployment time (stratify only when compatible), lock it, record when it was unlocked, and score it only after the final model is locked (REFORMS, PMID 38691601; TRIPOD+AI, PMID 38626948). - Tuning, thresholding, calibration, and model selection belong to development data. - Record the number of configurations evaluated. The best CV score is optimistic by selection; the reported estimate comes from nested CV, internal-external CV, the locked test set, or bootstrap correction, never from the tuning leaderboard. diff --git a/plugins/methodsmith/skills/method-verify/references/check-catalog.md b/plugins/methodsmith/skills/method-verify/references/check-catalog.md index 0bc265f3..f8927ad6 100644 --- a/plugins/methodsmith/skills/method-verify/references/check-catalog.md +++ b/plugins/methodsmith/skills/method-verify/references/check-catalog.md @@ -169,10 +169,10 @@ If `analysis/publication/figures/figure-manifest.json` exists, validate it with ```bash SKILL_DIR=""; -python3 "$SKILL_DIR/scripts/verify_stats.py" check analysis/numbers/stat-claims.json --out qc/stat_check.json +python3 "$SKILL_DIR/scripts/verify_stats.py" check analysis/numbers/stat-claims.json --alpha --out qc/stat_check.json ``` -For ordinary reference-distribution tests, the script uses the declared t/z `alternative` (`two-sided`, `greater`, `less`) and the upper tail for F/chi2, preserving signed statistic rounding. Each item records `p_method`; adjusted, exact, permutation and sequential P values need their actual method and are WARN/not checked here. Set `alternative="unknown"` when the SAP does not establish it. Never infer sidedness from significance or halve a reported P to make it agree. Legacy items without these fields retain ordinary two-sided t/z or upper-tail F/chi2 behavior; new extractions must declare them. Pass the SAP alpha with `--alpha`. The std-lib calculation needs no scipy. GRIM separately checks integer-count compatibility at the printed rounding. Malformed supported-test items fail closed. +For ordinary reference-distribution tests, the script uses the declared t/z `alternative` (`two-sided`, `greater`, `less`) and the upper tail for F/chi2, preserving signed statistic rounding. Each item records `p_method`; adjusted, exact, permutation and sequential P values need their actual method and are WARN/not checked here. Set `alternative="unknown"` when the SAP does not establish it. Never infer sidedness from significance or halve a reported P to make it agree. Legacy items without these fields retain ordinary two-sided t/z or upper-tail F/chi2 behavior; new extractions must declare them. Pass the SAP alpha explicitly with CLI `--alpha`; a top-level `alpha` field in the claims file does not configure this helper. The std-lib calculation needs no scipy. GRIM separately checks integer-count compatibility at the printed rounding. Malformed supported-test items fail closed. **Pass:** The reported P lies inside the recomputed rounding envelope (or a statistic has no reported P, in which case the recomputed P is attached); an integer count reproduces the mean or percentage. **Warn:** The P method or sidedness is unsupported/unknown (not checked, requiring analyst resolution); the reported P is inconsistent but stays on the same side of alpha; a mean or percentage is impossible only under an inferred granularity (confirm the measurement scale before failing it). diff --git a/scripts/evals/code-query.ts b/scripts/evals/code-query.ts index 6ae8af3e..74f4dfec 100644 --- a/scripts/evals/code-query.ts +++ b/scripts/evals/code-query.ts @@ -112,9 +112,10 @@ function assignments(root: Node): Array<{ node: Node; left: Node; right: Node }> return result.sort((a, b) => a.node.startIndex - b.node.startIndex) } -function binding(name: string, at: Node): Node | undefined { +function binding(name: string, at: Node, indexedWrites = true): Node | undefined { const assigned = assignments(owner(at)).filter(({ node, left }) => node.endIndex < at.startIndex && owner(node).id === owner(at).id && + (indexedWrites || left.type !== "subscript") && (left.text === name || left.namedChildren.some((child) => child.text === name)), ).at(-1) if (!assigned) return undefined @@ -127,6 +128,11 @@ function binding(name: string, at: Node): Node | undefined { } parent = parent.parent } + if (!indexedWrites && ["pattern_list", "tuple_pattern", "tuple"].includes(assigned.left.type) && + ["expression_list", "tuple"].includes(assigned.right.type)) { + const index = assigned.left.namedChildren.findIndex((child) => child.text === name) + return assigned.right.namedChildren[index] ?? assigned.right + } return assigned.right } @@ -213,16 +219,66 @@ function indexPartition(index: Node | undefined, loop: Node, bound: Bindings, de return assigned ? indexPartition(assigned, loop, bound, depth + 1) : bound.get(`index:${index.text}`) ?? "full" } +function writtenRoot(node: Node | undefined): string | undefined { + while (node && ["attribute", "subscript"].includes(node.type)) { + node = field(node, node.type === "attribute" ? "object" : "value") + } + return node?.type === "identifier" ? node.text : undefined +} + +function freshAllocation(node: Node | undefined): boolean { + if (!node) return false + if (["list", "dictionary", "set"].includes(node.type) && node.namedChildCount === 0) return true + if (node.type !== "call") return false + const name = field(node, "function")?.text + if (["np.empty", "np.zeros"].includes(name ?? "")) return true + if (name !== "np.full") return false + const fill = argumentFor(args(node), "fill_value", 1) + return !!fill && (["integer", "float", "true", "false", "none"].includes(fill.type) || + ["np.nan", "np.inf"].includes(fill.text)) +} + function partition(node: Node | undefined, loop: Node, bound: Bindings, depth = 0): Partition { if (!node || depth > 32) return "full" + if (["expression_list", "tuple"].includes(node.type)) { + const values = node.namedChildren.map((child) => partition(child, loop, bound, depth + 1)) + if (values.length && values.every((value) => value === "train")) return "train" + if (values.length && values.every((value) => value === "test")) return "test" + return "full" + } if (node.type === "identifier") { - const assigned = binding(node.text, node) - const writes = assignments(owner(node)).filter(({ node: assignment, left }) => - owner(assignment).id === owner(node).id && assignment.endIndex < node.startIndex && - (!assigned || assignment.startIndex > assigned.startIndex) && - left.type === "subscript" && field(left, "value")?.text === node.text) + const assigned = binding(node.text, node, false) + const aliases = new Set([node.text]) + let source = assigned + while (source?.type === "identifier" && !aliases.has(source.text)) { + aliases.add(source.text) + source = binding(source.text, source, false) + } + const writes: ReturnType = [] + for (const write of assignments(owner(node))) { + const { node: assignment, left, right } = write + if (owner(assignment).id !== owner(node).id || assignment.endIndex >= node.startIndex || + (assigned && assignment.startIndex <= assigned.startIndex)) continue + if (left.type === "identifier" && left.text !== node.text) { + if (right.type === "identifier" && aliases.has(right.text)) aliases.add(left.text) + else if (binding(left.text, node, false)?.id === right.id) { + let parent = assignment.parent + let conditional = false + while (parent && parent.id !== owner(node).id) { + if (["for_statement", "while_statement", "try_statement"].includes(parent.type) && + !(parent.startIndex <= node.startIndex && parent.endIndex >= node.endIndex)) conditional = true + parent = parent.parent + } + if (!conditional) aliases.delete(left.text) + } + } + if (left.type === "subscript" && aliases.has(writtenRoot(left) ?? "")) writes.push(write) + } if (writes.length) { const values = writes.map(({ right }) => partition(right, loop, bound, depth + 1)) + if (!freshAllocation(assigned)) { + values.push(assigned ? partition(assigned, loop, bound, depth + 1) : bound.get(node.text) ?? "full") + } if (values.every((value) => value === "train")) return "train" if (values.every((value) => value === "test")) return "test" return "full" @@ -257,7 +313,7 @@ function partition(node: Node | undefined, loop: Node, bound: Bindings, depth = if (base !== "full") return base return indexPartition(args(node)[0], loop, bound) } - if (callee?.type === "attribute" && ["astype", "to_numpy"].includes(field(callee, "attribute")?.text ?? "")) { + if (callee?.type === "attribute" && ["astype", "to_numpy", "reset_index"].includes(field(callee, "attribute")?.text ?? "")) { return partition(field(callee, "object"), loop, bound, depth + 1) } const record = nodes(node.tree.rootNode, "class_definition").find((definition) => diff --git a/tests/behavioral-eval-contract.test.ts b/tests/behavioral-eval-contract.test.ts index 59ab6b69..a4c70790 100644 --- a/tests/behavioral-eval-contract.test.ts +++ b/tests/behavioral-eval-contract.test.ts @@ -186,6 +186,133 @@ async function scoreCode(source: string, language: "python" | "r" = "python") { } describe("behavioral evaluation contract", () => { + test.each([["source", false], ["target", false], ["rebound-source", true]] as const)( + "tracks tuple label sharing through a %s mutation", + async (mutation, expected) => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + labels = frame.iloc[train]["outcome"] + X, y = frame.iloc[train][["feature"]], labels + ${mutation === "rebound-source" ? 'labels = frame.iloc[test]["outcome"]' : "pass"} + ${mutation === "target" ? "y" : "labels"}.iloc[0] = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(expected) + }, + ) + + test("bare partial writes do not launder the remaining held-out labels", async () => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + local = frame.iloc[train].reset_index(drop=True) + X = local[["feature"]] + y = frame.iloc[test]["outcome"].reset_index(drop=True) + y[0] = frame.iloc[train]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(false) + }) + + test.each([["alias.iloc[0]", false], ["alias[0]", false], ["alias.loc[0]", true]] as const)( + "tracks mutation through %s while respecting an unconditional alias rebind=%s", + async (accessor, rebind) => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + alias = y + ${rebind ? 'alias = frame.iloc[test]["outcome"]' : "pass"} + ${accessor} = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(rebind) + }, + ) + + test("does not discard alias taint after a conditional rebind", async () => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + alias = y + if condition: + alias = frame.iloc[test]["outcome"] + alias.iloc[0] = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(false) + }) + + test.each(["iloc[:]", "loc[:]", "iloc[0]", "loc[0]", "iloc[0:1]"])( + "rejects held-out labels written through %s after a training-only tuple assignment", + async (accessor) => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + y.${accessor} = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(false) + }, + ) + + test.each([["full", "train", false], ["train", "train", true], ["train", "test", false]] as const)( + "preserves original %s provenance when a %s value partially replaces it", + async (original, replacement, expected) => { + const originalRows = original === "full" ? "frame" : "frame.iloc[train]" + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X = frame.iloc[train][["feature"]] + y = ${originalRows}["outcome"] + y.iloc[0] = frame.iloc[${replacement}]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(expected) + }, + ) + + test.each([["train", true], ["test", false], ["full", false]] as const)( + "keeps destructured feature/label assignments confined to %s labels", + async (labels, expected) => { + const labelInput = labels === "full" ? 'frame["outcome"]' : `frame.iloc[${labels}]["outcome"]` + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +def choose(frame, labels): + frame = frame.reset_index(drop=True) + X, y = frame[["feature"]], labels.to_numpy() + search = GridSearchCV(model, grid) + return search.fit(X, y) +for fold, (train, test) in enumerate(outer.split(frame), start=1): + selected = choose(frame.iloc[train], ${labelInput}) +`) + expect(report.criteria.find((criterion) => criterion.id === "nested-tuning")?.passed).toBe(expected) + expect(report.pass).toBe(expected) + }, + ) + + test.each([["train", "reset_index", true], ["test", "reset_index", false], + ["full", "reset_index", false], ["train", "reindex", false]] as const)( + "tracks %s rows through %s without admitting held-out or full-data tuning", + async (rows, method, expected) => { + const input = rows === "full" ? "frame" : `frame.iloc[${rows}]` + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +def choose(frame): + frame = frame.${method}(drop=True) + search = GridSearchCV(model, grid) + return search.fit(frame[["feature"]], frame["outcome"]) +for fold, (train, test) in enumerate(outer.split(frame), start=1): + selected = choose(${input}) +`) + expect(report.criteria.find((criterion) => criterion.id === "nested-tuning")?.passed).toBe(expected) + expect(report.pass).toBe(expected) + }, + ) + test("does not manufacture a training alias from a dead branch or another helper's scope", async () => { for (const source of [ `from sklearn.model_selection import GridSearchCV diff --git a/tests/genome-build-audit.test.ts b/tests/genome-build-audit.test.ts index b66e10ce..a52d60ba 100644 --- a/tests/genome-build-audit.test.ts +++ b/tests/genome-build-audit.test.ts @@ -1,5 +1,5 @@ import { afterEach, expect, test } from "bun:test" -import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs" +import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs" import { tmpdir } from "node:os" import path from "node:path" @@ -7,12 +7,20 @@ const roots: string[] = [] const script = path.join(process.cwd(), "plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py") afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }) }) -function audit(files: Record, declared = "GRCh38", noTools = false) { +function audit(files: Record, declared = "GRCh38", noTools = false, samHeader?: string) { const root = mkdtempSync(path.join(tmpdir(), "genome-audit-")); roots.push(root) for (const [name, contents] of Object.entries(files)) writeFileSync(path.join(root, name), contents) + const bin = path.join(root, "bin") + if (samHeader !== undefined) { + mkdirSync(bin) + const samtools = path.join(bin, "samtools") + writeFileSync(samtools, '#!/bin/sh\n/bin/cat "$0.header"\n') + writeFileSync(samtools + ".header", samHeader) + chmodSync(samtools, 0o700) + } const result = Bun.spawnSync([Bun.which("python3")!, script, root, "--declared", declared, "--manifest", path.join(root, "audit.json"), "--report", path.join(root, "audit.md")], { - env: noTools ? { ...process.env, PATH: "" } : process.env, + env: samHeader !== undefined ? { ...process.env, PATH: bin } : noTools ? { ...process.env, PATH: "" } : process.env, }) return { code: result.exitCode, report: readFileSync(path.join(root, "audit.md"), "utf8"), manifest: JSON.parse(readFileSync(path.join(root, "audit.json"), "utf8")) } @@ -77,3 +85,54 @@ test("same-build chromosome naming differences are reported as naming incompatib expect(result.manifest.files.map((file: { status: string }) => file.status)).toEqual(["verified", "verified"]) expect(result.report).toContain("naming differs, which alone does not identify a build") }) + +test("unsupported CHM13 versions cannot evade version checks through separators or suffixes", () => { + for (const reference of ["T2T-CHM13 v1.1", "T2T-CHM13v2.0.1", "CHM13 version 1.1", "CHM13_version_1.1", "CHM13-v1.1", "T2T-CHM13"]) { + const result = audit({ "input.vcf": `##reference=${reference}\n##contig=\n` }, "T2T") + expect(result.code).toBe(2) + expect(result.manifest.files[0].status).toBe("unknown") + } + for (const reference of ["CHM13 v2.0", "CHM13_version_2.0", "CHM13-v2.0"]) { + expect(audit({ "input.vcf": `##reference=${reference}\n##contig=\n` }, "T2T").code).toBe(0) + } +}) + +test("CHM13 prereleases stay unresolved while supported release filenames and URLs remain valid", () => { + for (const reference of ["CHM13 v2.0-rc1", "CHM13 v2.0_rc1", "CHM13 v2.0-beta", "CHM13v2.0-rc1.fa.gz"]) { + const result = audit({ "input.vcf": `##reference=${reference}\n##contig=\n` }, "T2T") + expect(result.code).toBe(2) + expect(result.manifest.files[0].status).toBe("unknown") + } + for (const reference of ["chm13v2.0.fa.gz", "https://example.org/references/chm13v2.0.fasta?download=1"]) { + expect(audit({ "input.vcf": `##reference=${reference}\n##contig=\n` }, "T2T").code).toBe(0) + } +}) + +test("BAM assembly/reference tags and standard GFF3 build directives are inspected", () => { + const matching = audit({ "input.bam": "synthetic BAM placeholder" }, "GRCh38", false, + "@SQ\tSN:2\tLN:242193529\tAS:GRCh38\n") + expect(matching.code).toBe(0) + expect(matching.manifest.files[0].status).toBe("verified") + for (const tag of ["AS:GRCh37", "UR:file:///references/GRCh37.fa"]) { + const result = audit({ "input.bam": "synthetic BAM placeholder" }, "GRCh38", false, + `@SQ\tSN:1\tLN:248956422\t${tag}\n`) + expect(result.code).toBe(2) + expect(result.manifest.files[0].status).toBe("incompatible") + } + expect(audit({ "genes.gff3": "##genome-build NCBI GRCh38.p14\n1\tsource\tgene\t1\t2\t.\t+\t.\tID=x\n" }).code).toBe(0) + expect(audit({ "genes.gff3": "##genome-build NCBI GRCh37.p13\n1\tsource\tgene\t1\t2\t.\t+\t.\tID=x\n" }).code).toBe(2) +}) + +test("GENCODE description headers supply build evidence without fabricating absent declarations", () => { + for (const prefix of ["##description:", "#description:"]) { + const result = audit({ "gencode.gtf": `${prefix} evidence-based annotation of the human genome (GRCh38), version 44\n##provider: GENCODE\nchr1\tsource\tgene\t1\t2\t.\t+\t.\tgene_id x;\n` }) + expect(result.code).toBe(0) + expect(result.manifest.files[0].status).toBe("verified") + } + const mismatch = audit({ "gencode.gtf": "##description: evidence-based annotation of the human genome (GRCh37), version 19\n" }) + expect(mismatch.code).toBe(2) + expect(mismatch.manifest.files[0].status).toBe("incompatible") + const unknown = audit({ "gencode.gtf": "##description: annotation without a declared build\n##provider: GENCODE\n" }) + expect(unknown.code).toBe(2) + expect(unknown.manifest.files[0].status).toBe("unknown") +}) diff --git a/tests/pool-effects-runtime.test.ts b/tests/pool-effects-runtime.test.ts index e6984fd5..cb256253 100644 --- a/tests/pool-effects-runtime.test.ts +++ b/tests/pool-effects-runtime.test.ts @@ -4,8 +4,8 @@ import { existsSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs" import { tmpdir } from "node:os" import path from "node:path" -// Runs pool_effects.R on synthetic rows when Rscript and the meta package are -// available locally; CI has no R, so r-script-guards.test.ts pins the same fixes. +// Base-R uncertainty tests run in CI. Full pooling integration additionally +// requires the optional meta and ggplot2 packages. const script = path.join(process.cwd(), "plugins", "methodsmith", "skills", "method-meta-analysis", "scripts", "pool_effects.R") const hasR = spawnSync("Rscript", ["-e", "quit(status = !(requireNamespace('meta', quietly = TRUE) && requireNamespace('ggplot2', quietly = TRUE)))"]).status === 0 @@ -20,6 +20,35 @@ const contract = { } describe.skipIf(spawnSync("Rscript", ["--version"]).status !== 0)("effect uncertainty extraction with base R", () => { + test("accepts symmetric Wald intervals with zero source-rounding tolerance despite machine roundoff", () => { + const helper = path.join(path.dirname(script), "effect_uncertainty.R") + const proc = spawnSync("Rscript", ["-e", ` +source(${JSON.stringify(helper)}) +for (ratio in c(FALSE, TRUE)) { + center <- if (ratio) log(1.01) else .1 + bounds <- center + c(-1,1) * qnorm(.975) * .1 + dat <- data.frame(effect=if (ratio) exp(center) else center, + effect_lo=if (ratio) exp(bounds[1]) else bounds[1], effect_hi=if (ratio) exp(bounds[2]) else bounds[2], + ci_method="wald_normal", ci_level=.95, ci_rounding_tolerance=0, uncertainty_source="synthetic exact Wald interval") + stopifnot(abs(effect_uncertainty(dat, ratio)$se_te - .1) < 1e-14) +} +`], { encoding: "utf8" }) + expect(proc.status, proc.stderr).toBe(0) + }) + + test("machine roundoff allowance does not admit substantive asymmetry on a small identity scale", () => { + const helper = path.join(path.dirname(script), "effect_uncertainty.R") + const proc = spawnSync("Rscript", ["-e", ` +source(${JSON.stringify(helper)}) +dat <- data.frame(effect=0, effect_lo=-1e-20, effect_hi=5e-20, ci_method="wald_normal", ci_level=.95, + ci_rounding_tolerance=0, uncertainty_source="synthetic asymmetric interval") +rejected <- tryCatch({effect_uncertainty(dat, FALSE); FALSE}, error=function(e) TRUE) +stopifnot(rejected) +`], { encoding: "utf8" }) + expect(proc.status, proc.stderr).toBe(0) + }) + + test("uses declared confidence level and t df, preserves reported SEs, and rejects unresolved intervals", () => { const helper = path.join(path.dirname(script), "effect_uncertainty.R") const code = ` @@ -57,7 +86,7 @@ function run(rows: string[], overrides: Record = {}, extraArgs const dir = mkdtempSync(path.join(tmpdir(), "pool-effects-")) const input = path.join(dir, "in.csv") const out = path.join(dir, "out.md") - const keys = Object.keys(contract) + const keys = [...new Set([...Object.keys(contract), ...Object.keys(overrides)])] const inputRows = rows.map((row, i) => row + "," + keys.map((key) => overrides[key]?.[i] ?? (key === "independent_unit_id" ? `trial-${i}` : contract[key as keyof typeof contract]) ).join(",")) @@ -118,6 +147,21 @@ describe.skipIf(!hasR)("pool_effects.R on synthetic rows", () => { expect(readFileSync(r.out.replace(/\.md$/, "-contract.csv"), "utf8")).toContain("marginal mortality HR") }) + test("pools source-reported log SEs without CI bounds and agrees with metafor REML", () => { + const r = run([ + "1001,2020,A,300,HR,0.80,,,RCT", + "1002,2021,B,400,HR,0.75,,,RCT", + "1003,2022,C,500,HR,0.85,,,RCT", + ], { standard_error: ["0.3", "0.2", "0.1"], standard_error_scale: ["log", "log", "log"] }) + expect(r.code, r.stderr).toBe(0) + const reference = spawnSync("Rscript", ["-e", + 'm <- metafor::rma.uni(yi=log(c(.80,.75,.85)), sei=c(.3,.2,.1), method="REML"); cat(sprintf("point=%.3f", exp(coef(m)[[1]])))', + ], { encoding: "utf8" }) + expect(reference.status, reference.stderr).toBe(0) + expect(r.stdout).toContain(reference.stdout) + expect(readFileSync(r.out.replace(/\.md$/, "-contract.csv"), "utf8")).toContain("reported_SE") + }) + test("keeps studies with a missing sample size when no size filter is set", () => { const { stdout } = run([ "1001,2020,A,,HR,0.80,0.65,0.98,RCT", From 49185f52e5d85f2606fa4f8c90c156f35e650ff8 Mon Sep 17 00:00:00 2001 From: JC Rojas <126191042+sajor2000@users.noreply.github.com> Date: Tue, 27 Oct 2026 00:01:18 -0500 Subject: [PATCH 3/4] docs(audit): record scientific correction verification --- ...2026-10-26-scientific-rigor-corrections.md | 60 ++ .../2026-10-26-scientific-rigor-evidence.json | 676 ++++++++++++++++++ 2 files changed, 736 insertions(+) create mode 100644 docs/audits/2026-10-26-scientific-rigor-corrections.md create mode 100644 docs/audits/2026-10-26-scientific-rigor-evidence.json diff --git a/docs/audits/2026-10-26-scientific-rigor-corrections.md b/docs/audits/2026-10-26-scientific-rigor-corrections.md new file mode 100644 index 00000000..ab0b6fc4 --- /dev/null +++ b/docs/audits/2026-10-26-scientific-rigor-corrections.md @@ -0,0 +1,60 @@ +# Scientific rigor corrections + +This change addresses F01-F08 from the 2026-10-26 scientific accuracy and rigor audit. The audit screened 69 shipped skills with risk-based deeper inspection; neither that screen nor these corrections establishes comprehensive scientific or clinical validity. + +The fixes were reproduced and implemented from base `099d156e94e578213aa741e1d77a313b898097a8` on an isolated feature branch. The original checkout's unrelated edits were left untouched. No release-owned versions were changed. + +| Finding | Corrected behavior | Regression evidence | +|---|---|---| +| F01 | Preserve printed precision and signed t/z rounding intervals, including zero crossings and scientific notation. | Negative-statistic false passes, sign symmetry, distinct decimal precision, equivalent exponent notation; independent base-R P values. | +| F02 | Validate ordinary test direction; honor upper/lower/two-sided t/z and upper-tail F/chi-square. Unknown sidedness and unsupported P constructions remain unchecked warnings. | Valid one-sided non-inferiority result at alpha .025; both directions; unsupported methods and invalid inputs; stable extreme tails. | +| F03 | Prefer a source SE on the declared scale; otherwise require a documented symmetric Wald interval, confidence level, rounding allowance, and t df when applicable. Never manufacture a symmetric non-Wald interval. | Base-R normal 95%, normal 90%, t9, log-ratio, reported-SE and rejection cases; full pooling runtime tests with `meta` 8.5-0. | +| F04 | Check available assembly/reference tokens, diagnostic chromosome lengths and MD5s. Distinguish incompatible, unknown, uninspected and compatible header evidence; scope T2T lengths to CHM13 v2.0. | Explicit GRCh37/38 mismatch without MD5, contradictory headers, missing tools/evidence, unsupported T2T, and naming-only incompatibility. | +| F05 | Distinguish historical period transport from forward validation. Forward assessment uses earlier-only training, patient grouping and justified outcome-maturation gaps. | Fresh-context three-period deployment advice; existing ML-prediction regression case. | +| F06 | Check design rank and contrast estimability independently of PC1/PC2; batch-deletion stability cannot rescue complete aliasing. | Fresh-context completely aliased design hidden from PC1/PC2. | +| F07 | Define adherence using indicated components and initiation rules; keep mortality ascertainment consistent after discharge. | Fresh-context normotensive patient without fluid/pressor indications and 30-day all-cause endpoint. | +| F08 | Determine baseline observability through index; handle subsequent disenrollment through censoring/ascertainment assumptions. | Fresh-context day-90 disenrollment remains baseline eligible. | + +## Source and validation boundary + +The original audit used Exa, PubMed and Jev MCP tools for primary-source checks. This correction pass refreshed [Cochrane CI-to-SE guidance](https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-06) and the official [TimeSeriesSplit contract](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html) through Exa MCP; Jev screening passed both retrieved sources. Other audit anchors include the official [DESeq2 rank-deficiency guidance](https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#model-matrix-not-full-rank), [SCCM Hour-1 bundle](https://sccm.org/SCCM/media/SCCM/PDFs/Surviving-Sepsis-Campaign-Hour-1-Bundle.pdf), and [target-trial framework](https://pubmed.ncbi.nlm.nih.gov/26994063/). + +Executable regressions were observed failing before the relevant numerical/header fixes, then passing. Prose changes use versioned synthetic cases and skill-creator fresh-context forward tests with the current source injected at dispatch. Case, prompt and target digests are recorded before dispatch; scoring fails closed on drift. Two runs per affected case are required. Full traces and run workspaces remain under `/tmp/methodsmith/behavioral-evals/`; only sanitized summaries belong in Git. + +Header evidence does not establish complete sequence identity. Synthetic behavior tests do not establish clinical validity, exhaustive method coverage, or a validated accuracy rate. + +## Executable verification and review + +The final implementation is commit `424ce287291ce63a4bba4e2deced4dde4db2de05`. Its full local suite passed: **1,804 passed, 5 optional skips, 0 failed**, with 13,880 assertions across 122 test files. Type checking, release consistency, plugin validation, all 39 behavioral case definitions and whitespace checks passed. No website route changed; browser testing was not applicable. + +The numerical checks used base R and independent reference calculations, including a `metafor` REML comparison. Full pooling integration ran with `meta` 8.5-0 installed in a temporary library. A working local Python 3.12 interpreter was selected because the default Homebrew Python 3.14 had an Expat library-loading failure. No dependency lockfile or system installation changed. The five skips cover optional website, trial-engine, Parquet, workbook-rendering and Python numerical dependencies. CI now installs and probes base R so its core uncertainty checks cannot silently skip for a missing interpreter; optional R package integration remains a local check. + +Independent review reproduced five issues in the first candidate: ignored BAM assembly tags, incomplete CHM13 version parsing, ignored GENCODE assembly descriptions, roundoff rejection of exact Wald intervals, and a malformed reference-loading cue. Each was corrected with a failing reproduction and passing control. Further corrective reviews exposed held-out-label mutation false passes in the evaluator. The repairs preserve original provenance for partial writes, follow tuple/source aliases and accept supported training-only tuple/reset-index forms. All 61 independently authored tuning probes matched their expected decisions after repair; the genome review's 56 version/header controls also matched. These are bounded static-analysis and header checks, not execution of arbitrary Python or proof of sequence identity. + +The first code-review verdict was "Ready with fixes"; its retained findings and the subsequent corrective findings were resolved. A Claude Opus 5.5 peer contributed source review; its effort setting was unverified and its attempted runtime review did not execute. The parent independently reproduced the concrete findings. The earlier candidate's Jev advisory result was `escalate`, with no concrete defect identified; it is not counted as a passing review. + +The final Jev MCP gate also returned `escalate`: composite 0.616, safe-to-apply 0.20, with `truncated: true` and incomplete-context/low-confidence reasons. Four completion claims were labeled verified below automatic-acceptance confidence; the statistical-test coverage claim was unsupported, with no claim contradicted. The complete composed input was supplied within the documented size limits, but the service reported truncation. This advisory remains unresolved and is not counted as a passing gate. It identified no concrete additional defect. The passing executable checks and independent reproductions above remain the verification evidence; final human PR review is pending. + +## Fresh-context acceptance + +All **18 final runs across nine cases passed every hard gate**, with two independent generic contexts per case. Each dispatch injected the current on-disk skill source through skill-creator. `eval:prepare --complete` and `eval:score` recorded completion and scoring; `eval:report --k 2` checked the frozen manifests and aggregates. A separate digest check confirmed that every final case, prompt and entire skill directory still matches the prepared inputs and that the recorded run, response and evaluation files remain unchanged. + +| Case | Run 1 | Run 2 | +|---|---|---| +| Statistical test contract | 8/8 | 8/8 | +| Uncertainty extraction | 12/12 | 12/12 | +| Genome evidence | 8/8 | 8/8 | +| Forward temporal validation | 8/8 | 8/8 | +| Hidden omics aliasing | 8/8 | 8/8 | +| Indicated bundle components | 8/8 | 8/8 | +| Baseline observability | 6/6 | 6/6 | +| Compatible meta-analysis anchor | 12/12 | 12/12 | +| ML prediction regression | 94/94 | 94/94 | + +The [sanitized evidence manifest](2026-10-26-scientific-rigor-evidence.json) records all 36 launched runs, including superseded candidates: 33 passed and three failed under their original graders. Two question-case failures rejected correct mortality-ascertainment qualifiers; one ML-case failure rejected supported training-only tuple/reset-index code. The grader corrections retain explicit negative controls for wrong endpoints, missing ascertainment and held-out-data leakage. Those historical evaluations were preserved unchanged; acceptance uses fresh runs after the relevant source and grader corrections. The original three skill-creator scenarios and balanced trigger/near-miss sets were retained. + +Two passing observations per case do not establish a reliable error rate. The tests exercise synthetic decision contracts and scaffold structure; no clinical model was fitted, no assay QC was performed, and no literature pool was estimated by the behavioral evaluators. Human scientific review remains pending. + +## Base drift + +Before publication, `origin/main` had advanced to `e05b7f68f2bd0135dd9251b7f130d2e371123b53`, including boundary-hardening and CLIF changes. A read-only `git merge-tree --write-tree HEAD origin/main` succeeded without conflicts, producing tree `1ba9b86f06152e1bb67e23c85129f0e210331d4d`. The overlapping changes concern state/config paths, evidence-access prose and README inventory; they do not replace these scientific corrections. No branch history was rewritten and the original checkout was not modified. The local counts above describe the tested feature-branch source; PR CI will exercise the combined tree. diff --git a/docs/audits/2026-10-26-scientific-rigor-evidence.json b/docs/audits/2026-10-26-scientific-rigor-evidence.json new file mode 100644 index 00000000..05437ac6 --- /dev/null +++ b/docs/audits/2026-10-26-scientific-rigor-evidence.json @@ -0,0 +1,676 @@ +{ + "schema_version": "1.0", + "base_commit": "099d156e94e578213aa741e1d77a313b898097a8", + "tested_implementation_commit": "424ce287291ce63a4bba4e2deced4dde4db2de05", + "acceptance": { + "cases": 9, + "runs": 18, + "passed": 18, + "hard_gate_passed": 18, + "report_sha256": "7960343fc234dbb8d433bb1d5f4569aa3ff14390c18e165537ade6f140e17e31", + "input_binding": "All final case, prompt and entire skill-directory digests match current source.", + "artifact_binding": "All recorded response, run and evaluation digests match preserved artifacts." + }, + "history": { + "runs": 36, + "passed": 33, + "failed": 3, + "note": "All launched generic fresh-context runs are retained, including superseded candidates and three grader false failures. Earlier runs were not rescored or rewritten. Final acceptance uses only the explicit final run pairs." + }, + "limitations": [ + "Synthetic bounded cases are not comprehensive scientific or clinical validation.", + "Independent fresh contexts were dispatched through skill-creator with current source injected; hashes cannot establish statistical independence.", + "The bounded Python provenance scorer is not program execution or full control-flow analysis.", + "Full private/local traces and prompts remain outside Git; this file records sanitized digests and counts only." + ], + "runs": [ + { + "run_id": "scientific-fixes-20261026-method-verify-test-contract-r1", + "case_id": "method-verify-test-contract", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "9a87799f310632b89ba75da4a76ae046dc78aa8568d37bce03a6dfcedba8155e", + "run_sha256": "e0a32f56aa3f7dfa2b06a667fa42f0fdd6ee7d4715c8834092b3062e6de0f902", + "output_sha256": "817b69e4379ad567d3b1971b6fb0724d5cb97c00c7252c57b8cdc7b855a04caa", + "evaluation_sha256": "3e1086eb80b1f69c396374417848afb96d663a6dced78c2d840c8112049e5eb7", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-verify-test-contract-r2", + "case_id": "method-verify-test-contract", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "9a87799f310632b89ba75da4a76ae046dc78aa8568d37bce03a6dfcedba8155e", + "run_sha256": "ab14d4698d47540b56b09d2f4681bced5a8e2fbfa3008568779d73fc3dff8ffb", + "output_sha256": "6f542f8ea6973e81a7307e11358e7617c798cd3ac81f3daf1824b8bff9250ee7", + "evaluation_sha256": "11ba5d7d60b8d40c6a80dd5195f6f205bfe674d53fda3068761d5c3047688bb7", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-meta-uncertainty-contract-r1", + "case_id": "method-meta-uncertainty-contract", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "f7ac6d0142642318e1c060485f9bef2a9ea2103dcaf805d52e92081404a324d2", + "prompt_sha256": "0ff2052a12ceee2da8827aa72d1f231a58563a086b7296c8776e1357deabcd0c", + "target_sha256": "1414bc9516809ce75dd4cfd6a52234a6ee338bcb38724fd0f953e2fecc25bbcc", + "run_sha256": "134922d99404d239d44584e73e54a5001a4120aef1fda0661a3aea46f6e0f216", + "output_sha256": "7b136238f06fb6e0f33ecdfffb4428d500d9bf32c4d85574130ed676c12d2039", + "evaluation_sha256": "5640af3d703c7caa7fcdb2bfb24f3f2512649a94cefbc6fa04fdbd3fc8cc3ad0", + "score": 12, + "max_score": 12, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-meta-uncertainty-contract-r2", + "case_id": "method-meta-uncertainty-contract", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "f7ac6d0142642318e1c060485f9bef2a9ea2103dcaf805d52e92081404a324d2", + "prompt_sha256": "0ff2052a12ceee2da8827aa72d1f231a58563a086b7296c8776e1357deabcd0c", + "target_sha256": "1414bc9516809ce75dd4cfd6a52234a6ee338bcb38724fd0f953e2fecc25bbcc", + "run_sha256": "42b41b98a5c41306a778d701d7099d82de7cbf48992aa5837cad807e968dab6e", + "output_sha256": "01d8486393dcdf9425b501d0c5b521eec01fe3f4c202e1dbef67ef8d4aa197c3", + "evaluation_sha256": "ce06f4844275d7e42cfecb2369c1addb386b0867d6223c418c1a169af9c40ec9", + "score": 12, + "max_score": 12, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-genome-build-evidence-r1-v2", + "case_id": "method-genome-build-evidence", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "c40ff6e6506d72d34a5d873e33c5b7f12ac37dc5e654050044ca7d52085ddc48", + "prompt_sha256": "927a723ee8c21ca319f5bb233f69bccdc2e20c6255412d1cb0f31892f260b4d2", + "target_sha256": "f7ac22d4d9f8dce693081f8ca58ce738eda62a73323cba74e7c7f8c8f440a3a3", + "run_sha256": "d8478ccefa310d91b01f424a1fea91f14b2bf21845fd55e21d2a964caae10dba", + "output_sha256": "d81515dea9a1763f5893bd807b1b1c1ec6bfe31a3fd4a6c3cfdb9076c35650aa", + "evaluation_sha256": "c8cb327dece54d14322a1d419aca0ffc64268fb7b7ba119756bbab2eca1c97b7", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-genome-build-evidence-r2-v2", + "case_id": "method-genome-build-evidence", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "c40ff6e6506d72d34a5d873e33c5b7f12ac37dc5e654050044ca7d52085ddc48", + "prompt_sha256": "927a723ee8c21ca319f5bb233f69bccdc2e20c6255412d1cb0f31892f260b4d2", + "target_sha256": "f7ac22d4d9f8dce693081f8ca58ce738eda62a73323cba74e7c7f8c8f440a3a3", + "run_sha256": "d1f8adf5d4e94baf4ec0f8e4c799a88ec72c38f96b6fecf855f93f334befc74e", + "output_sha256": "a029b7e1d62c9954890ecc2d5ea4627c134bb70c7fd573311b20807beb78f096", + "evaluation_sha256": "3c0ff6fb90e5885f73f560071901fbc4b9a9044b99e34e9c93c0e629093f5ab8", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-forward-time-r1-v2", + "case_id": "method-model-choice-forward-time", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "25465cf25f4a209e4a5733ee9f40732888d3fa9ce8e3cf27c3764531fdcc6026", + "prompt_sha256": "ab2dfd6e9d00b8c85c673394085799403be899b15d4ec574d1bd8b4305f92dbb", + "target_sha256": "b9904da1b2d170c20f0963ca5c80888063cf518aca3deb9df9a67756b1a324ae", + "run_sha256": "b58b373923c70e6846552125d9c0e50bb2d9534cbbf9d1d3f93e248c71ba659d", + "output_sha256": "7655b5a900d629e9c0f2df8b1f4980af49c6dd5dcdd8c34092bd75d903052ded", + "evaluation_sha256": "13e34ba8499d5453d4f997abfafd71cee52d74f2a28af30204fa3a16a0c065e2", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-forward-time-r2-v2", + "case_id": "method-model-choice-forward-time", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "25465cf25f4a209e4a5733ee9f40732888d3fa9ce8e3cf27c3764531fdcc6026", + "prompt_sha256": "ab2dfd6e9d00b8c85c673394085799403be899b15d4ec574d1bd8b4305f92dbb", + "target_sha256": "b9904da1b2d170c20f0963ca5c80888063cf518aca3deb9df9a67756b1a324ae", + "run_sha256": "0d03dfcf91ab2374e2404bb261c551cfd8b173d25f1e4397b80bcb885fde52c9", + "output_sha256": "d71943f3e01dccf1da47bebedacb37b7b0a2ab3a5a3db24fd885e49c005adb7e", + "evaluation_sha256": "fdbc832e239ba197bc03f14b82f057d760510b077db9fee8f0036f4cb5edc8f6", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-omics-qc-hidden-aliasing-r1", + "case_id": "method-omics-qc-hidden-aliasing", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "ffea64cc9f302e3ea5779176bb4715802ddfc506335a37d67b1123a028a821e6", + "prompt_sha256": "d59c55c2a365ef50e4ed56f4d4888dd088331c6c1253435af6e9e214e09ea018", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "run_sha256": "34dc628c0bb12351a733c841687f99138811ca8cf672bd4df465efd212cb0980", + "output_sha256": "a55a4a45f8ff23883c582fdc848a83bbac553f6446cf787d7cc04d7297aeca07", + "evaluation_sha256": "87a863d29965dbdae26fab5be719119c665a30293660dad59b330382a589cdc7", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-omics-qc-hidden-aliasing-r2", + "case_id": "method-omics-qc-hidden-aliasing", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "ffea64cc9f302e3ea5779176bb4715802ddfc506335a37d67b1123a028a821e6", + "prompt_sha256": "d59c55c2a365ef50e4ed56f4d4888dd088331c6c1253435af6e9e214e09ea018", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "run_sha256": "2dbd469d1babbb8caeca1e03c87e095bbea170edbb814bf266f5f9f869743158", + "output_sha256": "80f2bd684aefb09856f3b81aff1d9cfebe359d172f4570692030f25d4eb21c15", + "evaluation_sha256": "0b8f5b74565c646a941f134496386cc93db620d8f33e69f44bd9e5ecb453f23f", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-question-indicated-bundle-r1", + "case_id": "method-question-indicated-bundle", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "648f7d5a31b19699b957fa2da7926d5221222d839b93ac6eab3e2e49e6497e62", + "prompt_sha256": "232c4c3950ac22570c7b66bc25fa9a039f71c2df5240ddb6f58d3c4b27b86b29", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "run_sha256": "1f6e722d06a3a6f65a74ad034aea2f4389927a0d248efc61793192ec167988bd", + "output_sha256": "891b7e20a53b6f08bd9173335fad2f7cf35d552c47593e0ca3af08460879fd2f", + "evaluation_sha256": "ededb2ced3f06cdf1196c07a728e15975533426a324ea616cc9e67fca37823e8", + "score": 4, + "max_score": 6, + "hard_gates_passed": false, + "pass": false + }, + { + "run_id": "scientific-fixes-20261026-method-question-indicated-bundle-r2", + "case_id": "method-question-indicated-bundle", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "648f7d5a31b19699b957fa2da7926d5221222d839b93ac6eab3e2e49e6497e62", + "prompt_sha256": "232c4c3950ac22570c7b66bc25fa9a039f71c2df5240ddb6f58d3c4b27b86b29", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "run_sha256": "90203d54fc75bf120b808a605f7aea2239033b7f570c48bd81f7c99dfc5351ec", + "output_sha256": "2561e7988ddf2c79519a54a483f7d29f036d99e7e212e352211994f2f58bf2f1", + "evaluation_sha256": "432fbab77ec115ad5f5dd5ceada7e51652242d1e46f3f828afe93979a20e8595", + "score": 4, + "max_score": 6, + "hard_gates_passed": false, + "pass": false + }, + { + "run_id": "scientific-fixes-20261026-method-cohort-baseline-observability-r1", + "case_id": "method-cohort-baseline-observability", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "0259b08789d0e92249ad52bf5723b089ec8f6e44f8d3c5bfdeeb3f8a93cdce0a", + "prompt_sha256": "bcc0dcf1b742711835401f1564af162fcef6b826a50f8e85b1d924ed7be274ed", + "target_sha256": "f44b17c19e347132d88c8a3deb25d87c2b33144bd231e69f9083c1a8b6155aae", + "run_sha256": "911bd25d959abc7861b080eee76c506734243d336c151e8bdee0a360d58b640f", + "output_sha256": "22f838387fc8acafc33edc46c16fe9dff6d275793f101aa591272af6b7884868", + "evaluation_sha256": "fdc69b4e1809d72255eb68f2a9e42047d920777a175b4e39e02b0778301d7202", + "score": 6, + "max_score": 6, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-cohort-baseline-observability-r2", + "case_id": "method-cohort-baseline-observability", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "0259b08789d0e92249ad52bf5723b089ec8f6e44f8d3c5bfdeeb3f8a93cdce0a", + "prompt_sha256": "bcc0dcf1b742711835401f1564af162fcef6b826a50f8e85b1d924ed7be274ed", + "target_sha256": "f44b17c19e347132d88c8a3deb25d87c2b33144bd231e69f9083c1a8b6155aae", + "run_sha256": "eaae09f70195a4a0689035865ce137a170738b1249808224f743d1d551af9ff6", + "output_sha256": "acd4615b93e0967faccbb52904f7b459d0a2d13ae96fbb87eae9f34f43aaa2ca", + "evaluation_sha256": "0ae4e27ae10f44629742e6ac81174327c8fccacbe72491e4c8848d8784c0805e", + "score": 6, + "max_score": 6, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-verify-test-contract-r1-v3", + "case_id": "method-verify-test-contract", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "22737862045d887490a57a56c2c218a1576e095d23920aaed6ba46ae6c1fab86", + "run_sha256": "d1c613475a8571e1debeef4f2cb1ff35be2481c4d1fae06795be5ebed7ac9c9a", + "output_sha256": "68d7ffe90a74c19098c28c1a34cb19189b6155843773db36433da7be3b8434a6", + "evaluation_sha256": "ba56dbdaf7d490d44531d61879be754aef8cdfbbac25e1c3df02ad84b52c62e5", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-verify-test-contract-r2-v3", + "case_id": "method-verify-test-contract", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "22737862045d887490a57a56c2c218a1576e095d23920aaed6ba46ae6c1fab86", + "run_sha256": "bfbfb0fb8e4827b942f78be3e2083d8e2e78559a576cfc18c2653941cda4379e", + "output_sha256": "309feb318b6c02dc750fc5ed1ed7432c4c3e9cc07be3b2fbefe32775d4980a4d", + "evaluation_sha256": "95487b554b5ccc90a8ad9f8e0e9aa36eb7501a456ad50b8f39bf1c73be9e6d2b", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-question-indicated-bundle-r1-v2", + "case_id": "method-question-indicated-bundle", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "b15e7d709712317bee7b776de634f6d5cabd1a1dd59de11bae8daba89554c8a4", + "prompt_sha256": "3bd0cbb6cb3200341f54385637cfbcaddaea4bb8d0d529a5318efff00f88b2a8", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "run_sha256": "ebf4129d7c40e3f698a0bb7b1124ee5c692eb714947f3ea03b58363adcf417a2", + "output_sha256": "1badc4215a0602d4009b0e56264253d9bec4f32345867f28baa4b82c48eab0d6", + "evaluation_sha256": "ab857e2881c4839c1a7804137c117eb9937a3b1e94d392d8932828fffa9120e3", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-question-indicated-bundle-r2-v2", + "case_id": "method-question-indicated-bundle", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "b15e7d709712317bee7b776de634f6d5cabd1a1dd59de11bae8daba89554c8a4", + "prompt_sha256": "3bd0cbb6cb3200341f54385637cfbcaddaea4bb8d0d529a5318efff00f88b2a8", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "run_sha256": "b5ab5eeb9fdcc06390a3ac136d753e9d3374f420c17409d7d2a3b7f0e40ef193", + "output_sha256": "eafbc59503e1375c853c866ab080107f5c1932bbb43b2f7fd8181d914fb4d8cf", + "evaluation_sha256": "1ec1beee51aeb72124c0ebdde0c2731c120c521ce043e82cf9e905f839b44383", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-ml-prediction-r1-v2", + "case_id": "method-model-choice-ml-prediction", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "cdf8a3636c9ddbc114c20f4cf5616dec0cb49244b124e6b4f8b7e6890df4ed37", + "prompt_sha256": "a5a9c0812d0541f479cf7990ec003deb615720deef95ab2582c854f1005e68bb", + "target_sha256": "b9904da1b2d170c20f0963ca5c80888063cf518aca3deb9df9a67756b1a324ae", + "run_sha256": "f725a5f32312cbb5f8afef0abb7423a12afd26cebe916677e6bf29b9a1e67629", + "output_sha256": "dfbb8f12fb8884ad6a285dde28a85046cfd6061171d130c010c0a06e51ec6c1a", + "evaluation_sha256": "bc3784d45e5ca3400d242eaa19583a7623c0b9cd7f3b396c7c335041fb0ab582", + "score": 94, + "max_score": 94, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-ml-prediction-r2-v2", + "case_id": "method-model-choice-ml-prediction", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "cdf8a3636c9ddbc114c20f4cf5616dec0cb49244b124e6b4f8b7e6890df4ed37", + "prompt_sha256": "a5a9c0812d0541f479cf7990ec003deb615720deef95ab2582c854f1005e68bb", + "target_sha256": "b9904da1b2d170c20f0963ca5c80888063cf518aca3deb9df9a67756b1a324ae", + "run_sha256": "3d0816e2ccbeedfa23c0772426f3640c74bf8c26cce5aba9697a0440a2b14a3c", + "output_sha256": "143af33e7fe9963f3b539aa5e828f1a732b7777134e10811b3f5e798234344b3", + "evaluation_sha256": "2fa448345aac1d96ea3c7c57b1857fb3afa7f6a030ec6c499961e296e2786b40", + "score": 91, + "max_score": 94, + "hard_gates_passed": false, + "pass": false + }, + { + "run_id": "scientific-fixes-20261026-method-meta-uncertainty-contract-r1-v2", + "case_id": "method-meta-uncertainty-contract", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "f7ac6d0142642318e1c060485f9bef2a9ea2103dcaf805d52e92081404a324d2", + "prompt_sha256": "0ff2052a12ceee2da8827aa72d1f231a58563a086b7296c8776e1357deabcd0c", + "target_sha256": "64c5e2f2bd9e7b4f2146febae3e2625e9c82e1cb389d723e82358aba2af7f8b3", + "run_sha256": "2b64c71b0eae7cbf7b990f6fc5e0216a526de1329e898ec653b84ef832629191", + "output_sha256": "5e74ea3d6231b8b4332d23dba0360ea138b9597580e7e4a67e97f2c5343e469d", + "evaluation_sha256": "dd9ea8c7fa85a2d7f024d913f53e52c220d5a619284a5f43d0b8383f5d6e9fee", + "score": 12, + "max_score": 12, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-meta-uncertainty-contract-r2-v2", + "case_id": "method-meta-uncertainty-contract", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "f7ac6d0142642318e1c060485f9bef2a9ea2103dcaf805d52e92081404a324d2", + "prompt_sha256": "0ff2052a12ceee2da8827aa72d1f231a58563a086b7296c8776e1357deabcd0c", + "target_sha256": "64c5e2f2bd9e7b4f2146febae3e2625e9c82e1cb389d723e82358aba2af7f8b3", + "run_sha256": "1cfffb6feb052a45e81ff614679fde24cb0e77e19f421e672628a1e6d0b4b0ac", + "output_sha256": "eb12eadaa9fdb69d1834101488f5b846cf136e853f4138af16fa6ed00b172147", + "evaluation_sha256": "040aeb6157f93c6862376f46d8f768676612e5ea7ec0d0ccef5b1ca4c20f988c", + "score": 12, + "max_score": 12, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-genome-build-evidence-r1-v3", + "case_id": "method-genome-build-evidence", + "repeat": 1, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "c40ff6e6506d72d34a5d873e33c5b7f12ac37dc5e654050044ca7d52085ddc48", + "prompt_sha256": "927a723ee8c21ca319f5bb233f69bccdc2e20c6255412d1cb0f31892f260b4d2", + "target_sha256": "b74887825c58a507032819f2c4d1f38647ce6544a689dfcdb861d9988be306cc", + "run_sha256": "7b7d81b3c2ce0ad2b482009916fe41a376fa0b109157685c3c5d5de2c9d12c91", + "output_sha256": "28f3da9a40ff66956ffa45b896b33c25a3368108dcf6150e65e2c709dd490236", + "evaluation_sha256": "9f9cc88816a7fb5bfde8b31da6f4bbad401a0733268438b5f4ac11004a13813c", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-genome-build-evidence-r2-v3", + "case_id": "method-genome-build-evidence", + "repeat": 2, + "final_acceptance": false, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "c40ff6e6506d72d34a5d873e33c5b7f12ac37dc5e654050044ca7d52085ddc48", + "prompt_sha256": "927a723ee8c21ca319f5bb233f69bccdc2e20c6255412d1cb0f31892f260b4d2", + "target_sha256": "b74887825c58a507032819f2c4d1f38647ce6544a689dfcdb861d9988be306cc", + "run_sha256": "81d5e2b21b8f92d6baf1f1b1126ec432d84e56c2b42cd92e11a93b9de2196816", + "output_sha256": "69802d31c9a72b52f3825063613324de2a6875fc0ed6c1ecaed7f485a4389666", + "evaluation_sha256": "cf7378dfb4f6847c4576c08e0063d836acbc96b533be71d079426984d8afc712", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-cohort-baseline-observability-r1-v2", + "case_id": "method-cohort-baseline-observability", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "0259b08789d0e92249ad52bf5723b089ec8f6e44f8d3c5bfdeeb3f8a93cdce0a", + "prompt_sha256": "bcc0dcf1b742711835401f1564af162fcef6b826a50f8e85b1d924ed7be274ed", + "target_sha256": "2af4cc178f11574cb1e9337321c64867abdcadd1a2e81bff873fa714a072dd74", + "run_sha256": "710de1b6d641bfdd89ca4007857869f6f8653ddbf9bc16e7f70a993b0913a51b", + "output_sha256": "d43e50bb79897b12ccfe9a30f75b6857d1b94f3c5e733285b1a1f978efb1d989", + "evaluation_sha256": "ba3a5b995f5854fcf0d9bc44c09bc5157329a58a99bac8c2a69b253c9fe4661e", + "score": 6, + "max_score": 6, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-cohort-baseline-observability-r2-v2", + "case_id": "method-cohort-baseline-observability", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "0259b08789d0e92249ad52bf5723b089ec8f6e44f8d3c5bfdeeb3f8a93cdce0a", + "prompt_sha256": "bcc0dcf1b742711835401f1564af162fcef6b826a50f8e85b1d924ed7be274ed", + "target_sha256": "2af4cc178f11574cb1e9337321c64867abdcadd1a2e81bff873fa714a072dd74", + "run_sha256": "827e5bdde55ddd116e57d231d0e473b9550ca23a756842e93a6e6e682dfdc418", + "output_sha256": "4e3c38977a5813e2dd0354e36722f7635e0e524659f737cc26b865a5e1414e68", + "evaluation_sha256": "fc1ed1f130e633b06e516242629f7536ecd7aa2d14656685ee3ee013b4feea45", + "score": 6, + "max_score": 6, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-verify-test-contract-r1-v4", + "case_id": "method-verify-test-contract", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "c34f6aefc2ab4e7716eb6328d1275b9faa5aa04361d725afb75fb8b0f3338957", + "run_sha256": "3abefd9cf514da4fcc53edd1a594c6a7dc696b77d41c60004de1093eefc5cf64", + "output_sha256": "b42bf4a35348b4c74589530b839b82e57ab9e2bf6a349c0f38fa07cb5db8f2fb", + "evaluation_sha256": "c979406036469cc027c82a00535d05bf33327b447994777954f8a4bbd9f9a284", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-verify-test-contract-r2-v4", + "case_id": "method-verify-test-contract", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "c34f6aefc2ab4e7716eb6328d1275b9faa5aa04361d725afb75fb8b0f3338957", + "run_sha256": "a7c125e82bc00b85db217be77f44c48638d82c73c565dda548895caf726240da", + "output_sha256": "30aed0a8a937a9d67fc066fbf67dd24fec09c7009d1f3f3fcdd4ed3e37d4ef88", + "evaluation_sha256": "7ea6baf5025a7814184d33b525b2fa7816ac87fc5704d9d9ca29dfa8af8744e1", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-forward-time-r1-v3", + "case_id": "method-model-choice-forward-time", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "25465cf25f4a209e4a5733ee9f40732888d3fa9ce8e3cf27c3764531fdcc6026", + "prompt_sha256": "ab2dfd6e9d00b8c85c673394085799403be899b15d4ec574d1bd8b4305f92dbb", + "target_sha256": "40e1c76192d0cd63df5b4c4aef7649ed38c79d5f558673bf9a531f4db675843e", + "run_sha256": "079c8387c722831dc17db02e270e683877fe18bfce07ffeb4da76dec11aa475e", + "output_sha256": "bfa7d1ed5a9b01b2536e6586977339c51fcd89919e908f5e0635edb260f280d5", + "evaluation_sha256": "2e92bb4ba7496e7dc126781fda5bc72138cac36d9d5f4c9c5d814e695719ed05", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-forward-time-r2-v3", + "case_id": "method-model-choice-forward-time", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "25465cf25f4a209e4a5733ee9f40732888d3fa9ce8e3cf27c3764531fdcc6026", + "prompt_sha256": "ab2dfd6e9d00b8c85c673394085799403be899b15d4ec574d1bd8b4305f92dbb", + "target_sha256": "40e1c76192d0cd63df5b4c4aef7649ed38c79d5f558673bf9a531f4db675843e", + "run_sha256": "642d987cebd276cd7cce759dfb6b21c472a2e070a12b6e99c2e9109362fda92e", + "output_sha256": "809aef9906ab6ae54cf0e38c1269837c3e6fe340add476495a7e7f56d1531007", + "evaluation_sha256": "f3abfd45db4eebbee90114a2cc1ca3f7406222d63ad656e80ae9550c03af7c67", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-meta-compatible-anchor-r1-v2", + "case_id": "method-meta-compatible-anchor", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "e5554a38a15fc71b3c8f415b86630db30963cf114f542f886aac6709b03cce06", + "prompt_sha256": "2ac8864c79e9bf6ea2fbd4332ac38795d07deb309e5c9e7b40f02d947a4d9a0c", + "target_sha256": "64c5e2f2bd9e7b4f2146febae3e2625e9c82e1cb389d723e82358aba2af7f8b3", + "run_sha256": "b64088cc00f95d51d0cc4555b819f272e94d962c0b914623d6982c3939dee16e", + "output_sha256": "90bc5a81ae91563589a14e1584b318d402c6e73ad115bd45218b5378b16e722d", + "evaluation_sha256": "c0e27002ea5f238c4b3e76b6aa3ba97cc6899968a65f4c745116c2db6963d0b5", + "score": 12, + "max_score": 12, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-meta-compatible-anchor-r2-v2", + "case_id": "method-meta-compatible-anchor", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "e5554a38a15fc71b3c8f415b86630db30963cf114f542f886aac6709b03cce06", + "prompt_sha256": "2ac8864c79e9bf6ea2fbd4332ac38795d07deb309e5c9e7b40f02d947a4d9a0c", + "target_sha256": "64c5e2f2bd9e7b4f2146febae3e2625e9c82e1cb389d723e82358aba2af7f8b3", + "run_sha256": "7859a86216bcd51d41d20db70b71de26d7e09f9f3e870ffa338dae1b3176f26e", + "output_sha256": "c88f6141e58842d349a077caf2edbc135b5deb45a18c7d1afb922a2ac5884f4f", + "evaluation_sha256": "3367f98e97551a8f475a4a31d72b933f7c2cf479fc9c2ea3ce22da14eff9e34b", + "score": 12, + "max_score": 12, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-genome-build-evidence-r1-v4", + "case_id": "method-genome-build-evidence", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "c40ff6e6506d72d34a5d873e33c5b7f12ac37dc5e654050044ca7d52085ddc48", + "prompt_sha256": "927a723ee8c21ca319f5bb233f69bccdc2e20c6255412d1cb0f31892f260b4d2", + "target_sha256": "f6d85316c6653f14dbb42cc73f345d467331ffefa3123a4eee7b703263aba3e4", + "run_sha256": "ae0285377896d243efa0a0701aa152629842bd650dd56570b699f9fd85b6018b", + "output_sha256": "2aa51bc5df5a5ab3416b14e56543a7249924f4d440526b45fedcd332af2f669c", + "evaluation_sha256": "643c1d93b4675b5797685c3b2085030016193f244878a649574b8c4713092e84", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-genome-build-evidence-r2-v4", + "case_id": "method-genome-build-evidence", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "c40ff6e6506d72d34a5d873e33c5b7f12ac37dc5e654050044ca7d52085ddc48", + "prompt_sha256": "927a723ee8c21ca319f5bb233f69bccdc2e20c6255412d1cb0f31892f260b4d2", + "target_sha256": "f6d85316c6653f14dbb42cc73f345d467331ffefa3123a4eee7b703263aba3e4", + "run_sha256": "652c5175be598cfa288b099992af5b47a1a6136cb86d4d23835a5badc1a20450", + "output_sha256": "b610158d90418b4f7e61b53a6734ccc3a1bfd65e755b589e3a51c6a6526675d3", + "evaluation_sha256": "444ddf2e76564b1133ff676542c98818ab08644c7cb6d47a4444ff0c380cd96e", + "score": 8, + "max_score": 8, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-ml-prediction-r1-v3", + "case_id": "method-model-choice-ml-prediction", + "repeat": 1, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "cdf8a3636c9ddbc114c20f4cf5616dec0cb49244b124e6b4f8b7e6890df4ed37", + "prompt_sha256": "a5a9c0812d0541f479cf7990ec003deb615720deef95ab2582c854f1005e68bb", + "target_sha256": "40e1c76192d0cd63df5b4c4aef7649ed38c79d5f558673bf9a531f4db675843e", + "run_sha256": "efd32594201b8268e61b18eeeba60d30c7ac6e16940c1f8c7575e5fc665c03e9", + "output_sha256": "2d9d53c0ff057ac92321873775080c719fb7d377cf982bc4d6d37743116afb3c", + "evaluation_sha256": "079bf98fbbafc16b063bc56a3ce6b79a4898f505b119ae5f7cead362bedb151b", + "score": 94, + "max_score": 94, + "hard_gates_passed": true, + "pass": true + }, + { + "run_id": "scientific-fixes-20261026-method-model-choice-ml-prediction-r2-v3", + "case_id": "method-model-choice-ml-prediction", + "repeat": 2, + "final_acceptance": true, + "model": "gpt-6.1-sol", + "runner": "skill-creator", + "case_sha256": "cdf8a3636c9ddbc114c20f4cf5616dec0cb49244b124e6b4f8b7e6890df4ed37", + "prompt_sha256": "a5a9c0812d0541f479cf7990ec003deb615720deef95ab2582c854f1005e68bb", + "target_sha256": "40e1c76192d0cd63df5b4c4aef7649ed38c79d5f558673bf9a531f4db675843e", + "run_sha256": "e2fc98e387bbaf199e1489c9a70f845400807d5b5474947d0fdb3363124c9211", + "output_sha256": "bd406f16849faf2f877105ac25b64c8f390f059370809d722569450f7b87f318", + "evaluation_sha256": "85b6c398d78d6d37366d3741a96f4d3114e1aeda42f51d3769f09b8da399d5e1", + "score": 94, + "max_score": 94, + "hard_gates_passed": true, + "pass": true + } + ] +} From e20ee1f1591f52e51e6b241736d5ed92e2a4f984 Mon Sep 17 00:00:00 2001 From: JC Rojas <126191042+sajor2000@users.noreply.github.com> Date: Tue, 27 Oct 2026 07:51:07 -0500 Subject: [PATCH 4/4] fix(review): resolve scientific feedback and bind advice evidence (#173) Correct numeric precision, tuple provenance and header diagnostics. Align scientific guidance and verify written advice alongside decision sidecars. Preserve frozen evaluation history and publish fresh acceptance evidence. --- .github/workflows/ci.yml | 4 +- ...2026-10-26-scientific-rigor-corrections.md | 2 + .../2026-10-27-pr173-feedback-evidence.json | 1320 +++++++++++++++++ docs/audits/2026-10-27-pr173-feedback.md | 44 + .../skill-design/behavioral-evaluation.md | 6 + .../case.yaml | 73 +- .../prompt.md | 2 +- .../method-genome-build-evidence/case.yaml | 119 +- .../method-genome-build-evidence/prompt.md | 2 +- .../case.yaml | 143 +- .../prompt.md | 2 +- .../case.yaml | 108 +- .../prompt.md | 2 +- .../case.yaml | 21 +- .../prompt.md | 4 + .../method-omics-qc-hidden-aliasing/case.yaml | 98 +- .../method-omics-qc-hidden-aliasing/prompt.md | 2 +- .../case.yaml | 115 +- .../prompt.md | 2 +- .../method-verify-test-contract/case.yaml | 73 +- .../method-verify-test-contract/prompt.md | 2 +- .../skill-creator/method-cohort/evals.json | 5 +- .../method-genome-build/evals.json | 3 +- .../method-genome-build/trigger-evals.json | 2 +- .../method-meta-analysis/evals.json | 7 +- .../method-meta-analysis/trigger-evals.json | 2 +- .../method-model-choice/evals.json | 5 +- .../method-model-choice/trigger-evals.json | 2 +- .../skill-creator/method-omics-qc/evals.json | 3 +- .../skill-creator/method-question/evals.json | 5 +- plugins/methodsmith/README.md | 3 +- .../skills/method-genome-build/SKILL.md | 6 +- .../scripts/audit_build.py | 23 +- .../skills/method-meta-analysis/SKILL.md | 6 +- .../references/effect-parser.md | 6 +- .../references/forward-temporal-validation.md | 2 +- .../method-verify/scripts/verify_stats.py | 10 +- scripts/evals/code-query.ts | 27 +- scripts/evals/lib.ts | 5 +- tests/behavioral-eval-contract.test.ts | 209 +++ tests/genome-build-audit.test.ts | 36 + tests/scientific-advice-evals.test.ts | 123 ++ tests/verify-stats.test.ts | 39 + 43 files changed, 2594 insertions(+), 79 deletions(-) create mode 100644 docs/audits/2026-10-27-pr173-feedback-evidence.json create mode 100644 docs/audits/2026-10-27-pr173-feedback.md create mode 100644 tests/scientific-advice-evals.test.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 069ecc5b..a94209d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,8 @@ jobs: # still runs this full suite when it lands on main. if: github.event_name != 'pull_request' || github.head_ref != 'release-please--branches--main' runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@v6 @@ -79,7 +81,7 @@ jobs: run: python3 -m pip install "openpyxl>=3.1,<4" "nbformat>=5.10,<6" - name: Setup base R for uncertainty regression tests - uses: r-lib/actions/setup-r@v2 + uses: r-lib/actions/setup-r@f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05 # v2 with: r-version: '4.5.0' diff --git a/docs/audits/2026-10-26-scientific-rigor-corrections.md b/docs/audits/2026-10-26-scientific-rigor-corrections.md index ab0b6fc4..d48f15d9 100644 --- a/docs/audits/2026-10-26-scientific-rigor-corrections.md +++ b/docs/audits/2026-10-26-scientific-rigor-corrections.md @@ -1,5 +1,7 @@ # Scientific rigor corrections +This records the pre-feedback candidate. See [PR173 feedback correction evidence](2026-10-27-pr173-feedback.md) for the later source changes and new frozen runs; the results below and their 36-run manifest remain historical evidence for the earlier candidate. + This change addresses F01-F08 from the 2026-10-26 scientific accuracy and rigor audit. The audit screened 69 shipped skills with risk-based deeper inspection; neither that screen nor these corrections establishes comprehensive scientific or clinical validity. The fixes were reproduced and implemented from base `099d156e94e578213aa741e1d77a313b898097a8` on an isolated feature branch. The original checkout's unrelated edits were left untouched. No release-owned versions were changed. diff --git a/docs/audits/2026-10-27-pr173-feedback-evidence.json b/docs/audits/2026-10-27-pr173-feedback-evidence.json new file mode 100644 index 00000000..8a314675 --- /dev/null +++ b/docs/audits/2026-10-27-pr173-feedback-evidence.json @@ -0,0 +1,1320 @@ +{ + "schema_version": "1.0", + "pr": 173, + "start_head": "49185f52e5d85f2606fa4f8c90c156f35e650ff8", + "scope": "First remote feedback remediation; public code and synthetic scenarios only.", + "prior_evidence": "docs/audits/2026-10-26-scientific-rigor-evidence.json", + "acceptance": { + "runs": 18, + "cases": 9, + "passed": 18, + "hard_gates_passed": true, + "current_frozen_inputs_match": true + }, + "history": { + "runs": 36, + "passed": 32, + "failed": 4, + "note": "All prior runs are preserved. Two question runs failed bounded wording checks despite correct endpoint/ascertainment advice. Two ML runs failed: one used an unsupported buffered-scaffold layout; the other hit an arbitrary Riley-to-assumption proximity limit. Both also had false AUPRC negation warnings. The prose graders were corrected, and the ML fixture now explicitly requests the documented module-import/direct-split layout. The final question pair is retained; new ML and omics pairs cover the final source/grammar changes. The same artifact/agreement condition was extended to the three unflagged equivalent advice cases, with new pairs for each. Original hashes/reports were not rewritten or rescored." + }, + "soft_review_notes": [ + { + "case_id": "method-model-choice-ml-prediction", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v4-20261027-method-model-choice-ml-prediction-2", + "criterion_id": "auprc-supplementary-only", + "verdict": "manually confirmed false-positive soft heuristic", + "quoted_output": "Do not label AUPRC the primary metric", + "reason": "The label refusal is outside the bounded predicate vocabulary. The original 93/95 score is preserved; all hard gates and the frozen weighted threshold pass. No rescore or new vocabulary patch was used to force a perfect score." + } + ], + "validation": { + "full_suite": { + "command": "PATH=/tmp/methodsmith/scientific-fixes/20261026/bin:$PATH R_LIBS_USER=/tmp/methodsmith/scientific-fixes/20261026/R-library PYTHONDONTWRITEBYTECODE=1 bun test", + "passed": 1853, + "skipped": 5, + "failed": 0, + "assertions": 14142, + "files": 123 + }, + "typecheck": "passed", + "release_validate": "passed", + "plugin_validate": "passed", + "eval_validate": { + "cases": 39, + "status": "passed" + }, + "advice_controls": { + "tests": 7, + "assertions": 100, + "status": "passed" + }, + "skill_creator_sets": { + "tests": 9, + "status": "passed" + } + }, + "jev": { + "action": "escalate", + "truncated": true, + "safe_to_apply": 0.4, + "composite": 0.5165, + "claim_verdicts": { + "verified": 2, + "unsupported": 2, + "contradicted": 0 + }, + "concrete_defect_identified": false, + "passing_gate": false, + "note": "One complete unabridged initial code/test/eval patch input was supplied; service reported truncation and low confidence. Not retried. Later bounded grader corrections have separate source/evidence verification; this remains an unresolved advisory snapshot." + }, + "late_grader_verification": { + "earlier": { + "tool": "jev_verify", + "verified": 3, + "contradicted": 0, + "support_probabilities": [ + 0.97, + 1, + 1 + ] + }, + "final": { + "tool": "jev_verify", + "verified": 1, + "contradicted": 2, + "unsupported": 0, + "needs_review": 3, + "confidence": [ + 0.69, + 0.79, + 0.4 + ], + "status": "unresolved advisory" + }, + "direct_check": "The two contradicted source claims were rechecked against the exact current criteria and targeted executable controls: 2 tests and 20 assertions passed. No advisory was retried or represented as a passing full-patch gate." + }, + "limits": [ + "Two observations per case do not establish reliability or clinical validity.", + "The final shared-scorer delta changes claim_absent only. The retained question pair uses regex/JSON criteria and is unaffected; its recorded whole-scorer hash differs and is disclosed. ML and omics have fresh pairs under the final claim grammar.", + "Prose checks detect bounded phrases and canonical decision agreement, not arbitrary semantic contradictions.", + "Python provenance checking is bounded static analysis, not execution or a full language analysis.", + "BAM tests use synthetic samtools stubs; header evidence does not prove sequence identity.", + "Five optional tests require unrelated website, trial-engine, Parquet, workbook-rendering or Python numerical dependencies.", + "The ML fixture acceptance is restricted to module imports and explicit/cached split-pair loops; unsupported buffered layouts remain outside the static checker.", + "The bot docstring percentage was not independently reproduced. Four nontrivial missing helper contracts were documented; seven pre-existing lint findings remain outside scoped blocks." + ], + "runs": [ + { + "case_id": "method-cohort-baseline-observability", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-cohort-baseline-observability-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.086Z", + "completed_at": "2026-10-27T11:29:58.396Z", + "case_sha256": "7376ffc363e60d2a6e8742e7c2accf90b0ac3579025315c88a49c074bc09b2b9", + "prompt_sha256": "ef2e0aa817d0d30a5f4e6ed3c4c04d0be6b326b634a75a95b0221d55b45d19c9", + "target_sha256": "2af4cc178f11574cb1e9337321c64867abdcadd1a2e81bff873fa714a072dd74", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 18, + "max_score": 18, + "failed_criteria": [], + "hashes": { + "run": "a49608d8cb15011914c6c2ffcc1b8af5649bee7385113933004e410a8c804605", + "response": "a3e11f5b166cd580d9282867943025097e4207c0bca1f7f0ae26cfc5a1ec9888", + "evaluation": "4bda67b31e6b63b33930c95c1c43a89c33f3c19108dccf73f43a651623533fff", + "manifest": "f4ecdf25dc7c404316ad21e059c700ada31dd559a9a9fb52e99385ba8b96d90f" + } + }, + { + "case_id": "method-cohort-baseline-observability", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-cohort-baseline-observability-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.129Z", + "completed_at": "2026-10-27T11:30:00.039Z", + "case_sha256": "7376ffc363e60d2a6e8742e7c2accf90b0ac3579025315c88a49c074bc09b2b9", + "prompt_sha256": "ef2e0aa817d0d30a5f4e6ed3c4c04d0be6b326b634a75a95b0221d55b45d19c9", + "target_sha256": "2af4cc178f11574cb1e9337321c64867abdcadd1a2e81bff873fa714a072dd74", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 18, + "max_score": 18, + "failed_criteria": [], + "hashes": { + "run": "8aafaa8f6cef3e5ba22264dce7da5974b35a3f51e9e67b673c6dcef02b64648d", + "response": "2927856b59813e03f592246b1f8b53d378411a5719bc077f2043f9dd5f6d48c5", + "evaluation": "3ceb8c67718decf7a3453089726cb8a7a235c4d86e62f4e8da8969b5c831470d", + "manifest": "92b0c84e0f0a617833fa17c842d6d7149e40f214e7ebae6c79c880d6b57b3a3c" + } + }, + { + "case_id": "method-model-choice-forward-time", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-model-choice-forward-time-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.174Z", + "completed_at": "2026-10-27T11:32:56.481Z", + "case_sha256": "ecf0d19f3db3758dbf073c2872a1dec5050713ca922f26d50c3bc9c555284644", + "prompt_sha256": "db3e730bc401b72db96ad97cb9ed78d38557b1bedc2c4bee664d4335319457ca", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 26, + "max_score": 26, + "failed_criteria": [], + "hashes": { + "run": "c7898367067a04c137ca5b3a56671388a74d3132f6518e4cc49ebd6f49f88789", + "response": "1c8072212af7764c601370f7cefe2161e25392a175bc1d3a5c21765272cee2e1", + "evaluation": "82501c363e0cc863fd35c924195cc58504700ed6b8aa42a3ea5045b3e1ee3591", + "manifest": "6e9169ebc7c1ee4beba0b33ee7bfc8cbc81baff746f79e446a04f23da6907391" + } + }, + { + "case_id": "method-model-choice-forward-time", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-model-choice-forward-time-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.218Z", + "completed_at": "2026-10-27T11:32:01.034Z", + "case_sha256": "ecf0d19f3db3758dbf073c2872a1dec5050713ca922f26d50c3bc9c555284644", + "prompt_sha256": "db3e730bc401b72db96ad97cb9ed78d38557b1bedc2c4bee664d4335319457ca", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 26, + "max_score": 26, + "failed_criteria": [], + "hashes": { + "run": "be7d3664e37cf23e5eed4af4ae88df258687593aaca5b76e7c367e6510ddb764", + "response": "50b396217d314f4b2b47601199f7b61792b336599eed7931b1d793b86773a14b", + "evaluation": "dc3a9e3a7295e78ee281e46390ebe89ede3e3e9188319673e0012777abd73058", + "manifest": "dbf1a2cb313e0c3e874363f477f8f5ff7141ec87db7f7c27a7963008f29fc225" + } + }, + { + "case_id": "method-omics-qc-hidden-aliasing", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-omics-qc-hidden-aliasing-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.262Z", + "completed_at": "2026-10-27T11:35:11.969Z", + "case_sha256": "81fcbdbcf8241347459756af0d65dad095c6c833649ecfb02fc19718c29863cb", + "prompt_sha256": "c4ed6231ecc865e797c3164cef480414508903cef97f242371730c2e3f69195a", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 22, + "max_score": 22, + "failed_criteria": [], + "hashes": { + "run": "cb5f003bbe87aced3403877e7678f785d12ad4721909db10ec581ece0e5c797f", + "response": "57a1caf68b2f268d30ebe4422c5211996b44012dcd1b10185f268a9919239894", + "evaluation": "1ac8d4c00835c0fd414ad921e6abf16d65dd074e7b2c031f170ebdcd80fc3c45", + "manifest": "ade1dcd5a791b00af33b579916ca0eb4cccb965218a6dd9da4872a34dd4ce38d" + } + }, + { + "case_id": "method-omics-qc-hidden-aliasing", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-omics-qc-hidden-aliasing-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.309Z", + "completed_at": "2026-10-27T11:35:07.384Z", + "case_sha256": "81fcbdbcf8241347459756af0d65dad095c6c833649ecfb02fc19718c29863cb", + "prompt_sha256": "c4ed6231ecc865e797c3164cef480414508903cef97f242371730c2e3f69195a", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 22, + "max_score": 22, + "failed_criteria": [], + "hashes": { + "run": "641886052a764f8cc65c4c2b6dbe43772af537a3e68b43bafb4231ac04fe4889", + "response": "b3fc945021ac9e5f61dc2b940352c2a990e4a981ad5f0e866e1f02b7bfadf32c", + "evaluation": "9e03469e3ff8a3bb616e40de90da60f1e572286719073a791123798e97f13132", + "manifest": "a35ff632edd856da9f8f718f52ad3b7e274aba5e53dea8bcc98feef996008d8a" + } + }, + { + "case_id": "method-question-indicated-bundle", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-question-indicated-bundle-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.350Z", + "completed_at": "2026-10-27T11:36:50.796Z", + "case_sha256": "a34e3a68d50137ccdcdd86e45bfb0358eefc1af2999ba5625443c92ce83c1679", + "prompt_sha256": "0eced5dc405647778fabba876935f99ab35bc2c6341e49f315620bd5f67e7a6b", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": false, + "hard_gates_passed": false, + "credential_scan_passed": true, + "score": 26, + "max_score": 28, + "failed_criteria": [ + "written-mortality-endpoint" + ], + "hashes": { + "run": "6ba7cfb5c1180c40d73e5ed41ea7b613e97c1acdb772a22a0731269dcaddcbb4", + "response": "a45324fa600706323207ef715c0ba87b8773666a06d29147fbce6d3fff313767", + "evaluation": "8ab303cdc5a402d71ff366de7c259822661a04976037716a90e9c191f10ceb9c", + "manifest": "5230bb7de2c8c237635a1b59418bea4a6e300b0a023a30e0070999eab4d49ab2" + } + }, + { + "case_id": "method-question-indicated-bundle", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-question-indicated-bundle-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.393Z", + "completed_at": "2026-10-27T11:37:30.493Z", + "case_sha256": "a34e3a68d50137ccdcdd86e45bfb0358eefc1af2999ba5625443c92ce83c1679", + "prompt_sha256": "0eced5dc405647778fabba876935f99ab35bc2c6341e49f315620bd5f67e7a6b", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 28, + "max_score": 28, + "failed_criteria": [], + "hashes": { + "run": "2aefed8515c4125d24af3e9d885d567e90b345932735dee2357322702f42b371", + "response": "ac4817d2f2921d2dde6b47828b5b8f8e59f36a1e777b07d4f00682e859b02989", + "evaluation": "25c3699a65fb1437886db556d11eca96cb1ab6fc26eb67f28809190c3e85db80", + "manifest": "c1553074ff87dfb10022ecde2ed707ced850661033ae4bdfbda1ff6779f56cf0" + } + }, + { + "case_id": "method-meta-uncertainty-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-meta-uncertainty-contract-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.442Z", + "completed_at": "2026-10-27T11:38:06.530Z", + "case_sha256": "6915abd86f55d041228b7cfdb55ff8f1ac02fc71f26e89af14409ca900938754", + "prompt_sha256": "adb3976a9c82e48428ecd2b6a43e9ccd1bff69a50ae5c52896becac8e7947307", + "target_sha256": "af0e68560d7195e6e4c2555e5afdb0bbaa7f765a685a7cb7bb75d61205893eb6", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 16, + "max_score": 16, + "failed_criteria": [], + "hashes": { + "run": "d1a92ca7432971963576e57b89ad138fca1242d53ff20590c9c3761d69bee2fc", + "response": "037f9a9120e6bc8922ed1a33987095aeeca870062e126d59be1a30457c08b73e", + "evaluation": "c0beef29f9e60e539255fe6320410758788b4569799ae8369e87b0321a8967a7", + "manifest": "a455fd08243d377a579626e8fe037404ff51157adf4a2d7c4bd1ba1ed69f457c" + } + }, + { + "case_id": "method-meta-uncertainty-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-meta-uncertainty-contract-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.484Z", + "completed_at": "2026-10-27T11:39:12.824Z", + "case_sha256": "6915abd86f55d041228b7cfdb55ff8f1ac02fc71f26e89af14409ca900938754", + "prompt_sha256": "adb3976a9c82e48428ecd2b6a43e9ccd1bff69a50ae5c52896becac8e7947307", + "target_sha256": "af0e68560d7195e6e4c2555e5afdb0bbaa7f765a685a7cb7bb75d61205893eb6", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 16, + "max_score": 16, + "failed_criteria": [], + "hashes": { + "run": "2607282a02f70da6bca256b0408f68c6e48e87773834c15691bc40b8afb3d8dd", + "response": "e300e563007fced09a3338d7c6dd7038afd82001dd0d7fb69cd19a95bf7710e0", + "evaluation": "c7a910733a9fd4751c155cd54582d36acbc25767b3440af546ed3ec2834d1b47", + "manifest": "d902670e16043c8ab7b1c43a484223cf2e59c330c7db72353f1d6984f9c7bf60" + } + }, + { + "case_id": "method-genome-build-evidence", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-genome-build-evidence-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.526Z", + "completed_at": "2026-10-27T11:39:23.190Z", + "case_sha256": "bba235e2694b1f70e34cc5cd010c2e3404648f8a15022101eec1986a7cfc6cc1", + "prompt_sha256": "5a5584c4cf5f35cb390211fed379db4a4b014c9339a26ca1ad4ce3f5063109bf", + "target_sha256": "f5dee699de2c0c9a3c1706b13e85265db2b48e6512e55462ae8488b17fdd8523", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 12, + "max_score": 12, + "failed_criteria": [], + "hashes": { + "run": "6dd84db891009ae034d19ac2c2ba3a41d2c44af936a05d77b6b8356e4f928e12", + "response": "9f8de08817327f6c626f41e49e9aeedeaec60d86e165979794bf0ae18fd82938", + "evaluation": "4f4ba1a00f95c8379ea9d00e65b0c7f2050e07d832369392fb4f7ab8180ddea2", + "manifest": "7af88d36b0a83738e8ed90f1d32ad796cb461afe26dd28d4a0ab7439b7356968" + } + }, + { + "case_id": "method-genome-build-evidence", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-genome-build-evidence-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.572Z", + "completed_at": "2026-10-27T11:40:26.773Z", + "case_sha256": "bba235e2694b1f70e34cc5cd010c2e3404648f8a15022101eec1986a7cfc6cc1", + "prompt_sha256": "5a5584c4cf5f35cb390211fed379db4a4b014c9339a26ca1ad4ce3f5063109bf", + "target_sha256": "f5dee699de2c0c9a3c1706b13e85265db2b48e6512e55462ae8488b17fdd8523", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 12, + "max_score": 12, + "failed_criteria": [], + "hashes": { + "run": "72123706c2e8ca039b4d34a807d3b1bb12648d73f7ef9f721de513cb51e0bb19", + "response": "9c2aa3b5068d6482274463c0ca901395a24e9068d518cc036bbec8e88fd17790", + "evaluation": "947b767b48a8e229f42c1a2c119fb5231a5fb0b1e558f45a850bb7428397fb98", + "manifest": "16810c13475a506be71f1d37503e6590742561474c2538e90dc25655da088585" + } + }, + { + "case_id": "method-verify-test-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-verify-test-contract-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.614Z", + "completed_at": "2026-10-27T11:41:58.958Z", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "366bd18b6e7b9b1961449fd30ca18f492bacfa2df85622872cc7352444491432", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 8, + "max_score": 8, + "failed_criteria": [], + "hashes": { + "run": "587cc70f2898ffd903312e386bddfe4bdfcc25c953d6359393f78e6ca83a4c99", + "response": "d12c265185c468963f12fe1df322d7ea2aa4d67ddbfa2267cdfc0084c0cfb333", + "evaluation": "9b8cccfd847d0e9a312030ee01aafbf6820aa7dcbad6ccb3bdbc508cfcb60ea0", + "manifest": "a1bc14662462303a57e51788d091ab449cafcfeec5fd22672a2e3a9016108580" + } + }, + { + "case_id": "method-verify-test-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-verify-test-contract-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.656Z", + "completed_at": "2026-10-27T11:42:10.228Z", + "case_sha256": "dfe57baa3c5032e551f52772ddd002c39b48a1942a42a91756b0de9a8c4c326e", + "prompt_sha256": "1a5da35854ef421f2431d9199ced3800bcea8b87f04c2ccd16d40cc1507c8fb4", + "target_sha256": "366bd18b6e7b9b1961449fd30ca18f492bacfa2df85622872cc7352444491432", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 8, + "max_score": 8, + "failed_criteria": [], + "hashes": { + "run": "0b1322f2add5f82a54927b7248847d92586f195641408dfefec20cde9dc9bf11", + "response": "f720bb645041f887bda378c24db4ab21271cec55513a2021be4a1529be139347", + "evaluation": "65cdb8a1fee2f31a4c135982856c90333549d8ed02b0d04e573aa13a83ae7797", + "manifest": "b8588264c57ddac05624bafd84df403269396b18a38b83b2f0efceb69219b2c8" + } + }, + { + "case_id": "method-meta-compatible-anchor", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-meta-compatible-anchor-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.701Z", + "completed_at": "2026-10-27T11:43:25.224Z", + "case_sha256": "e5554a38a15fc71b3c8f415b86630db30963cf114f542f886aac6709b03cce06", + "prompt_sha256": "2ac8864c79e9bf6ea2fbd4332ac38795d07deb309e5c9e7b40f02d947a4d9a0c", + "target_sha256": "af0e68560d7195e6e4c2555e5afdb0bbaa7f765a685a7cb7bb75d61205893eb6", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 12, + "max_score": 12, + "failed_criteria": [], + "hashes": { + "run": "31f237bee9acf8b5ee85892ca1cbd47083123673b6d6d99497e9903528b11e70", + "response": "d3d370ea4341c1b7ce42e35462f97c0876c124c57e952c1e018994d58ca93281", + "evaluation": "3509248ed340844241287d22d1d67e1801ae316da8528fe1af915a3ea65aa5eb", + "manifest": "181151016949a73680499337849fbcf32ede170f5a2e818b4749ccadca07353f" + } + }, + { + "case_id": "method-meta-compatible-anchor", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-meta-compatible-anchor-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.743Z", + "completed_at": "2026-10-27T11:43:38.098Z", + "case_sha256": "e5554a38a15fc71b3c8f415b86630db30963cf114f542f886aac6709b03cce06", + "prompt_sha256": "2ac8864c79e9bf6ea2fbd4332ac38795d07deb309e5c9e7b40f02d947a4d9a0c", + "target_sha256": "af0e68560d7195e6e4c2555e5afdb0bbaa7f765a685a7cb7bb75d61205893eb6", + "current_inputs_match": true, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 12, + "max_score": 12, + "failed_criteria": [], + "hashes": { + "run": "ff5acb88246c438f6f2565fa271f417dfa0f2d6643aac97b1c7c9a608dce9bd3", + "response": "c4d1db1eb2e4e511d156a2282950c5d4e997177c4837b4638a5d3efc81cc260f", + "evaluation": "a6eeda3a6ed6f1586e7d0132e0e1b1fb5c891005efecaba201ec1369c82165a5", + "manifest": "bce17357ae51418545ccf4bf8f49c0f8df20301f2023475bca3909cb802c9d99" + } + }, + { + "case_id": "method-model-choice-ml-prediction", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-model-choice-ml-prediction-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.799Z", + "completed_at": "2026-10-27T11:51:54.189Z", + "case_sha256": "cdf8a3636c9ddbc114c20f4cf5616dec0cb49244b124e6b4f8b7e6890df4ed37", + "prompt_sha256": "a5a9c0812d0541f479cf7990ec003deb615720deef95ab2582c854f1005e68bb", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 94, + "max_score": 94, + "failed_criteria": [], + "hashes": { + "run": "272e454f1dd48722fb63d57bf3dabcf408ff8ab06aa45eb8bcf28621e3ecbc40", + "response": "24f937c98260e1de5093c8b6a2da7866f54d7b764a4ac4d869f0e0f9bcfd5420", + "evaluation": "0451f922c29fea096f156699ac5ab1c6d4241b4fe5d3d4be681dd97280d98da9", + "manifest": "c3f6bd02368070e83ba79701a6a3b26b3199663c99e99d6337a043ba50592fa8" + } + }, + { + "case_id": "method-model-choice-ml-prediction", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1-20261027-method-model-choice-ml-prediction-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:28:46.855Z", + "completed_at": "2026-10-27T11:55:25.135Z", + "case_sha256": "cdf8a3636c9ddbc114c20f4cf5616dec0cb49244b124e6b4f8b7e6890df4ed37", + "prompt_sha256": "a5a9c0812d0541f479cf7990ec003deb615720deef95ab2582c854f1005e68bb", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": true, + "pass": false, + "hard_gates_passed": false, + "credential_scan_passed": true, + "score": 89, + "max_score": 94, + "failed_criteria": [ + "auprc-supplementary-only", + "scaffold-tuning-inside-resampling" + ], + "hashes": { + "run": "3b263d439fe6e08b83ca32d15df037f0502e4d1fd87910fbac0688f64e57c265", + "response": "87c3aa0cfb861105dd71d4fb76bd75cc12ad7ea8bbbd3f92fa8b60affc7d5e9c", + "evaluation": "b070f5fdbbc180e918d77c2073e0fc2bc15ef0053c91be1370117eeffb429325", + "manifest": "ad24e032e6fd1dd6187b1099f9b620f5a3f1857bf1a9e569a5ca8eb449487014" + } + }, + { + "case_id": "method-question-indicated-bundle", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v2-20261027-method-question-indicated-bundle-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:38:40.263Z", + "completed_at": "2026-10-27T11:53:56.980Z", + "case_sha256": "5082980bc941ed5dc7effa0ee704d0c3f92eeb5881a6e1c6122f1b92f9a659b0", + "prompt_sha256": "0eced5dc405647778fabba876935f99ab35bc2c6341e49f315620bd5f67e7a6b", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 28, + "max_score": 28, + "failed_criteria": [], + "hashes": { + "run": "dbdb56556d49ee01af7c68dd806c3131c74a761f6767eeda2a88b5846aa7a2b4", + "response": "d51af252e15cf4a7e3d04e8f6a87c64934b81076f770fb6bdbd9b4716630b671", + "evaluation": "e46784f32e70a0ab7f8faeb5efb00b431c48096e2ea344897e89cdb0093316d3", + "manifest": "d90379bfeb73aef45d7dd733eed3b103aa97a4664f94c38439331f602c63007b" + } + }, + { + "case_id": "method-question-indicated-bundle", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v2-20261027-method-question-indicated-bundle-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T11:38:40.303Z", + "completed_at": "2026-10-27T11:56:36.543Z", + "case_sha256": "5082980bc941ed5dc7effa0ee704d0c3f92eeb5881a6e1c6122f1b92f9a659b0", + "prompt_sha256": "0eced5dc405647778fabba876935f99ab35bc2c6341e49f315620bd5f67e7a6b", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "current_inputs_match": false, + "grader_sha256": null, + "grader_current_match": null, + "changed_claim_grammar_relevant": false, + "pass": false, + "hard_gates_passed": false, + "credential_scan_passed": true, + "score": 26, + "max_score": 28, + "failed_criteria": [ + "written-ascertainment" + ], + "hashes": { + "run": "d072ddfa059d1329bafe1309a721e52b519733115e85a4c873f1de1c9942e2b7", + "response": "99221fee8d954032bef54349a5b848f5b25e521b80628f13b86fa3a1d90c1c1a", + "evaluation": "76ad1578104ca228a275873fe6a74ccf0089db1ad28851b2ae4aa10c5db2593a", + "manifest": "5a1ff645d8e61a99c9b121fed583662c0e5b5ddab8ac4e9fa1268c6a81842dc2" + } + }, + { + "case_id": "method-model-choice-ml-prediction", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v3-20261027-method-model-choice-ml-prediction-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:07:46.272Z", + "completed_at": "2026-10-27T12:20:56.207Z", + "case_sha256": "013af925e5395d14973cbd330120c17f7ab812b509576f3a858274ae298f1a07", + "prompt_sha256": "af3a7712dbf64f0ae357334b632a77718653337a03748e6b7ff8b9fb9f3513bd", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": false, + "grader_sha256": { + "scripts/evals/lib.ts": "bf8077f34b8dbf58f8973c9099d7628a5710f2bd58ea2ccefaa05d8feb046336", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": false, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 95, + "max_score": 95, + "failed_criteria": [], + "hashes": { + "run": "926aa2371a042bef8f3b922c9cd2a3fdcb2fc5234b4fee2e071529fbfc21c935", + "response": "7cf8c95560f187d72f069ab101c405e060ca12860c25f347631b2121d45c7685", + "evaluation": "03bfc11402f4b11661095eaa0d9a4d19cea01e9da875d0db5a7bf9afce1d6129", + "manifest": "7c70fec98706c1d79c980ad6d049cb992c6bf5a326007345c6e9f5fca00d89c1" + } + }, + { + "case_id": "method-model-choice-ml-prediction", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v3-20261027-method-model-choice-ml-prediction-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:07:46.332Z", + "completed_at": "2026-10-27T12:18:17.633Z", + "case_sha256": "013af925e5395d14973cbd330120c17f7ab812b509576f3a858274ae298f1a07", + "prompt_sha256": "af3a7712dbf64f0ae357334b632a77718653337a03748e6b7ff8b9fb9f3513bd", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": false, + "grader_sha256": { + "scripts/evals/lib.ts": "bf8077f34b8dbf58f8973c9099d7628a5710f2bd58ea2ccefaa05d8feb046336", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": false, + "changed_claim_grammar_relevant": true, + "pass": false, + "hard_gates_passed": false, + "credential_scan_passed": true, + "score": 91, + "max_score": 95, + "failed_criteria": [ + "auprc-supplementary-only", + "sample-size-checked" + ], + "hashes": { + "run": "dea9ce8e1354e09385de6b667457f7e677c7156e46585f09e24387b18cda8c08", + "response": "4171c0bb66a0bb0a2e2111b52ea58c54dccdfc1d5d1ddfdd36be2d655cbb16a1", + "evaluation": "01738d57183888db88fe4885633d274b5439b72923c212b53c33f87c9c9f92da", + "manifest": "e2801a15ac2c37624e7e11afdc81fe40ea3ea4a16661ce8750589ec63df65869" + } + }, + { + "case_id": "method-question-indicated-bundle", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v3-20261027-method-question-indicated-bundle-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:07:46.380Z", + "completed_at": "2026-10-27T12:20:01.986Z", + "case_sha256": "8471091193ab5b331890dfa02516608db03fa9a2d97e7e4793db0a8d544a2a6a", + "prompt_sha256": "0eced5dc405647778fabba876935f99ab35bc2c6341e49f315620bd5f67e7a6b", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "bf8077f34b8dbf58f8973c9099d7628a5710f2bd58ea2ccefaa05d8feb046336", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": false, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 28, + "max_score": 28, + "failed_criteria": [], + "hashes": { + "run": "431e5ec19eef29276041e80a85f96a9689b50a298119e1cdc8a2b6683de1e6b2", + "response": "c6787b58f431a5a00a3c77637dba17fcd964549ba53bda521b8cd505876780c6", + "evaluation": "8eaf57007e8618b4d64128916438d6ddf4d1f1616664ad54dcf9c83c0ee2f2ad", + "manifest": "b1d0af5a306bbcc64a4d0ea4dbf39437f4cf388263ded055dec44cc38760cfa4" + } + }, + { + "case_id": "method-question-indicated-bundle", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v3-20261027-method-question-indicated-bundle-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:07:46.421Z", + "completed_at": "2026-10-27T12:22:27.020Z", + "case_sha256": "8471091193ab5b331890dfa02516608db03fa9a2d97e7e4793db0a8d544a2a6a", + "prompt_sha256": "0eced5dc405647778fabba876935f99ab35bc2c6341e49f315620bd5f67e7a6b", + "target_sha256": "ff834d89dab9ed9cbcb195e273b106633724721b0fe0a73058126e222f70b57a", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "bf8077f34b8dbf58f8973c9099d7628a5710f2bd58ea2ccefaa05d8feb046336", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": false, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 28, + "max_score": 28, + "failed_criteria": [], + "hashes": { + "run": "66777f061f58f20ec976dd07f2fdd34ba4a21d56a8ca0f423faec4747cc72c7e", + "response": "33bbb04a3476777ff6c83ba63163ae6a0bcaf3306a91dadc7fd4869c954f5c5a", + "evaluation": "ace00729716076dd7cebd2cfdf3f4f259569b2c83a8172fcb6f6ffe8eaea3d36", + "manifest": "4f2a968e64da04d495bb38938026231d07e780e50e2f2c2774a0785da442ebea" + } + }, + { + "case_id": "method-omics-qc-hidden-aliasing", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v3-20261027-method-omics-qc-hidden-aliasing-1", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:07:46.462Z", + "completed_at": "2026-10-27T12:22:19.941Z", + "case_sha256": "81fcbdbcf8241347459756af0d65dad095c6c833649ecfb02fc19718c29863cb", + "prompt_sha256": "c4ed6231ecc865e797c3164cef480414508903cef97f242371730c2e3f69195a", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "bf8077f34b8dbf58f8973c9099d7628a5710f2bd58ea2ccefaa05d8feb046336", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": false, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 22, + "max_score": 22, + "failed_criteria": [], + "hashes": { + "run": "6d2d5ecf022585f8882c210eed1096c740d251a60137796edfda874d8ff130f1", + "response": "2389fab65010f10b30d093ca3fac47facf8589a6738bfe01f74fa9801590513e", + "evaluation": "e1e2f8b03e30c20ddd0dcc349716e66117f18091dbdee7cc0e29846fc2a8b2a2", + "manifest": "b0d709b56a203e2fd623746c58a9cdc2ff2cc36c3e1fcb91bd7907382975581c" + } + }, + { + "case_id": "method-omics-qc-hidden-aliasing", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v3-20261027-method-omics-qc-hidden-aliasing-2", + "acceptance": false, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:07:46.503Z", + "completed_at": "2026-10-27T12:24:28.124Z", + "case_sha256": "81fcbdbcf8241347459756af0d65dad095c6c833649ecfb02fc19718c29863cb", + "prompt_sha256": "c4ed6231ecc865e797c3164cef480414508903cef97f242371730c2e3f69195a", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "bf8077f34b8dbf58f8973c9099d7628a5710f2bd58ea2ccefaa05d8feb046336", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": false, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 22, + "max_score": 22, + "failed_criteria": [], + "hashes": { + "run": "89f086d0f23b28acf34e64a149cc41e71eabd5d2db0e2b9c8bfbc58da0565936", + "response": "e3b61ec7d240debfcda5de50b96d2fcfae6632f56f3abeb1a0b746387da10dff", + "evaluation": "a026d07bfaf0cb26c513378fc9050e89839a9f1df211c7edbc5cbe9c0cb61f4a", + "manifest": "641e6d65b526cb5832b87354b891eff7e2d7b5a501c4cb46015b091f360aaaa7" + } + }, + { + "case_id": "method-model-choice-ml-prediction", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v4-20261027-method-model-choice-ml-prediction-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:26:35.489Z", + "completed_at": "2026-10-27T12:40:50.577Z", + "case_sha256": "fd772d4cdd4eb514aa2b21959e43e4c8e544ee2ea2534abc0ef22874da070962", + "prompt_sha256": "af3a7712dbf64f0ae357334b632a77718653337a03748e6b7ff8b9fb9f3513bd", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 95, + "max_score": 95, + "failed_criteria": [], + "hashes": { + "run": "c163d576bdb5ed9be57a244619abb9a889ba6e5db98b547b975e1ccb14579c2f", + "response": "b6d442258f90f09a5b4365ea5388909b7e0862e4f7c788f8a114ecd07fc06675", + "evaluation": "7f26e6df629b0a5bc8224a4ee9b894109e4ac25e2964f81ceb4bc65628c027bc", + "manifest": "8ba1ae3b93ef4ed11d2e2f32c72baa9c2d8fa4678cca552cbd052b3cbbec5032" + } + }, + { + "case_id": "method-model-choice-ml-prediction", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v4-20261027-method-model-choice-ml-prediction-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:26:35.544Z", + "completed_at": "2026-10-27T12:35:42.926Z", + "case_sha256": "fd772d4cdd4eb514aa2b21959e43e4c8e544ee2ea2534abc0ef22874da070962", + "prompt_sha256": "af3a7712dbf64f0ae357334b632a77718653337a03748e6b7ff8b9fb9f3513bd", + "target_sha256": "fee5be595a398992c828aa34fe0d33b2eb8814f02cddf56452ed969171c8830f", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 93, + "max_score": 95, + "failed_criteria": [ + "auprc-supplementary-only" + ], + "hashes": { + "run": "e71a824bc9d1c23739026462e9a63a03bfea7ccc7431f8ae4e19d0b6c1680724", + "response": "add2e827da65cb9a4d547a3b2497cb5e51853462aa681f42cf36d1501d8c280a", + "evaluation": "6441193f8f12f6ce5bd7bc1906cfaef39b56f48ecf4854b1012613df9530c922", + "manifest": "66758921763b982c1cddf5a3be20fb504e2d500e2e640e6c2bcd03b15d03a633" + } + }, + { + "case_id": "method-omics-qc-hidden-aliasing", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v4-20261027-method-omics-qc-hidden-aliasing-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:26:35.590Z", + "completed_at": "2026-10-27T12:41:17.805Z", + "case_sha256": "81fcbdbcf8241347459756af0d65dad095c6c833649ecfb02fc19718c29863cb", + "prompt_sha256": "c4ed6231ecc865e797c3164cef480414508903cef97f242371730c2e3f69195a", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 22, + "max_score": 22, + "failed_criteria": [], + "hashes": { + "run": "726243ed886a78ad806c21eafefb606b6ab9591df10b8c776efc9d1b8c065a52", + "response": "83ea4fbc47f03f19c59e007eaa4eba83669b31089eb20be9f1378bf7a603db22", + "evaluation": "ce163a00872b20e66ded43140aaa92ac0e56e947053b507a135254f8f0cb00e3", + "manifest": "016a02e2ba543bcd7e46649d25b0eecf562e38cd925e2ef1bc3a62de78b7d3ba" + } + }, + { + "case_id": "method-omics-qc-hidden-aliasing", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v4-20261027-method-omics-qc-hidden-aliasing-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:26:35.630Z", + "completed_at": "2026-10-27T12:42:31.107Z", + "case_sha256": "81fcbdbcf8241347459756af0d65dad095c6c833649ecfb02fc19718c29863cb", + "prompt_sha256": "c4ed6231ecc865e797c3164cef480414508903cef97f242371730c2e3f69195a", + "target_sha256": "cdc37be090d90275eda5fac9d7ef85e104f2f54679d14124ce46e8f96abcad08", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": true, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 22, + "max_score": 22, + "failed_criteria": [], + "hashes": { + "run": "9f6245450d7330575b15cc1fb490ff8b46352e426ca256bf9d99c5bad55c8413", + "response": "64706dc9c39c28cc78366c26746b14f13f3426f90339360af9c7ec081c29d118", + "evaluation": "c5fe05391bfe713364dfc9142b3145ad4a6382974105e22fff8e130a4303618a", + "manifest": "84885a72c4737f2d8f89d01c83cd42878c1d8f22120dd8657112379632f86240" + } + }, + { + "case_id": "method-meta-uncertainty-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v5-20261027-method-meta-uncertainty-contract-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:39:36.224Z", + "completed_at": "2026-10-27T12:42:44.309Z", + "case_sha256": "83a2105e4dc04f906d9badd8fe237676ec88237e975dd64169b0a9b9eaafc859", + "prompt_sha256": "e54acfc123ab173d2242c6897f7a8ba2a9c22696823362e10c7b21ac227d4179", + "target_sha256": "af0e68560d7195e6e4c2555e5afdb0bbaa7f765a685a7cb7bb75d61205893eb6", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 36, + "max_score": 36, + "failed_criteria": [], + "hashes": { + "run": "26a578f61dd15f3dcbbf5e8d3a828584bf889d1602cb1db73a297837d03eaf23", + "response": "93ceeaf4597980c39beae0a416c9ce628b28334e16adc519a4ce7ae1d566df22", + "evaluation": "bb53435ebb5f883672cd0bd4793249f1a9f8b4fe9cd7947ee374512e5de71222", + "manifest": "2c7dd3967fd372b86a465064adc7c931514090160f8fb3978b537c005178bc7e" + } + }, + { + "case_id": "method-meta-uncertainty-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v5-20261027-method-meta-uncertainty-contract-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:39:36.272Z", + "completed_at": "2026-10-27T12:43:59.245Z", + "case_sha256": "83a2105e4dc04f906d9badd8fe237676ec88237e975dd64169b0a9b9eaafc859", + "prompt_sha256": "e54acfc123ab173d2242c6897f7a8ba2a9c22696823362e10c7b21ac227d4179", + "target_sha256": "af0e68560d7195e6e4c2555e5afdb0bbaa7f765a685a7cb7bb75d61205893eb6", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 36, + "max_score": 36, + "failed_criteria": [], + "hashes": { + "run": "f169641ac0689c20e260fe66e8efa49434a34482f011bf578901807762d10f67", + "response": "9e9aca47844313bdff0a52ee6f4469dd2fd4ec73d8ca326e2d590c46385cfc14", + "evaluation": "2b86be36a9a1e8adc6a7d04db39873657081705732d5186ed50059455ba43293", + "manifest": "e5e9dfad8bb6591961cf891741a5798488c580e577e26b7b7153e0a3461b4f62" + } + }, + { + "case_id": "method-genome-build-evidence", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v5-20261027-method-genome-build-evidence-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:39:36.312Z", + "completed_at": "2026-10-27T12:43:54.093Z", + "case_sha256": "69bae1cf798c7b2bd86dcab19ded2c2ee126ff126576de03c3e03fbf348a452a", + "prompt_sha256": "b3d26635bfbe3881bd05abda194ef3b562438ce257a442537f21b81f9535881d", + "target_sha256": "f5dee699de2c0c9a3c1706b13e85265db2b48e6512e55462ae8488b17fdd8523", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 28, + "max_score": 28, + "failed_criteria": [], + "hashes": { + "run": "9971b351b77c684289577c096f1b049e0596ba81243655c3a1f29b8745e22405", + "response": "057163bfdd12aa2308bf2454a108bf9818e6c29d2a2f7e6658d74a1f7f2f6c62", + "evaluation": "9ef2d168a0a04463ea8145958c648dca7ee1c96c4c74f59e4ba947e4ecb7ef2e", + "manifest": "2ed65fa0ec54d365ebf1215a4d8c9cba5fbaae5e90ab8f64ec3533ef4f8e3c99" + } + }, + { + "case_id": "method-genome-build-evidence", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v5-20261027-method-genome-build-evidence-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:39:36.354Z", + "completed_at": "2026-10-27T12:45:31.207Z", + "case_sha256": "69bae1cf798c7b2bd86dcab19ded2c2ee126ff126576de03c3e03fbf348a452a", + "prompt_sha256": "b3d26635bfbe3881bd05abda194ef3b562438ce257a442537f21b81f9535881d", + "target_sha256": "f5dee699de2c0c9a3c1706b13e85265db2b48e6512e55462ae8488b17fdd8523", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 28, + "max_score": 28, + "failed_criteria": [], + "hashes": { + "run": "58cf1465b5452972bedbd4b6eb76e6ad91a87fefe3a92aaa0a07fc70c288a19c", + "response": "1ac8342b115b6ab46a8cb2d26be543fac7664040d9120493ab4c28e4a5e854ef", + "evaluation": "bdff96674422e4d7b87e9277da35a9060475d4f8bac4a090decd8a1ea598ceaf", + "manifest": "971a74cb05b5e7738f81b61093a54b57acf3735f26416d5834a9030035da251b" + } + }, + { + "case_id": "method-verify-test-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v5-20261027-method-verify-test-contract-1", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:39:36.402Z", + "completed_at": "2026-10-27T12:45:53.429Z", + "case_sha256": "08398d6754d67a517a159a9700302f471ffd26245b70e509dec795c67b6bb448", + "prompt_sha256": "b949e89c95cc862bab04108c3762b32d04c2b620fe9f543951936fa42be49ca3", + "target_sha256": "366bd18b6e7b9b1961449fd30ca18f492bacfa2df85622872cc7352444491432", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 20, + "max_score": 20, + "failed_criteria": [], + "hashes": { + "run": "942c70534eb4ab66ccd9498d498e8d2a66da8761b6dbccc7e4cc93df3df7ab36", + "response": "b9a2aa1bc8a1317118673ea123bf5cafa701b88c7f9189b2022c8802934043c9", + "evaluation": "c6403b728be7b633ed4d9650241c6792c1fe8752f3ac4e65fc4293ef619eb63f", + "manifest": "1fab8d2ca9c317a371da2373c84a454cc99a8ebc7c0fa6f7a74b4c3439ea37a0" + } + }, + { + "case_id": "method-verify-test-contract", + "run_dir": "/tmp/methodsmith/behavioral-evals/pr173-r1v5-20261027-method-verify-test-contract-2", + "acceptance": true, + "runner": "skill-creator", + "model": "gpt-6.1-sol", + "options": { + "reasoningEffort": "xhigh", + "serviceTier": "default" + }, + "started_at": "2026-10-27T12:39:36.442Z", + "completed_at": "2026-10-27T12:47:16.363Z", + "case_sha256": "08398d6754d67a517a159a9700302f471ffd26245b70e509dec795c67b6bb448", + "prompt_sha256": "b949e89c95cc862bab04108c3762b32d04c2b620fe9f543951936fa42be49ca3", + "target_sha256": "366bd18b6e7b9b1961449fd30ca18f492bacfa2df85622872cc7352444491432", + "current_inputs_match": true, + "grader_sha256": { + "scripts/evals/lib.ts": "ff331cd728dd09e542deed9cc451b5a5923573bc44c57dd409caeffec67b41ef", + "scripts/evals/code-query.ts": "efd999a0c8088265e4bc051e7ed9d717d235d7d504995a0bfe7de26e91b4730e" + }, + "grader_current_match": true, + "changed_claim_grammar_relevant": false, + "pass": true, + "hard_gates_passed": true, + "credential_scan_passed": true, + "score": 20, + "max_score": 20, + "failed_criteria": [], + "hashes": { + "run": "656621e1ed77a402f9cb44046f9c1ce7f3229b6ea17dcdb798d31dca4f21c64e", + "response": "fff8dd1628b0559175bc042c4b1cc489246181e4453dfbd28529bea79679a0b1", + "evaluation": "f1321c80055ec51e46a26cc40c5df4032953eb85f3edd39536206f7c78505444", + "manifest": "dd40a3162c204bd706874ed7d23a6285df75cf4ae27b3300c2583f0cff82aa06" + } + } + ] +} diff --git a/docs/audits/2026-10-27-pr173-feedback.md b/docs/audits/2026-10-27-pr173-feedback.md new file mode 100644 index 00000000..3dc37073 --- /dev/null +++ b/docs/audits/2026-10-27-pr173-feedback.md @@ -0,0 +1,44 @@ +# PR173 feedback correction evidence + +This records the first remote feedback remediation from head `49185f52e5d85f2606fa4f8c90c156f35e650ff8`. All 14 inline threads, the review submission and the top-level walkthrough were assessed centrally against actual source. The rising thread count was the first remote batch, not evidence of repeated non-convergence. No release versions, dependency locks, installed caches, original-checkout files or repository settings changed. + +The patch corrects integral-float rounding and flat tuple-alias false passes, deduplicates header diagnostics, and aligns uncertainty, build and forward-validation instructions. It permits a frozen model with one independent later cohort while retaining earlier-only development boundaries. All seven new advisory cases now require the written artifact, decision agreement and bounded content checks; correct JSON alone cannot rescue missing or contradictory advice. Forward prompts omit scored conclusions, and the separate uncertainty check no longer contradicts the original HR-pooling request. + +Regression controls failed before the numerical/header/alias corrections and pass afterward. Allocation controls cover empty containers and NumPy allocations, nonliteral held-out fills and nested attribute writes. Advisory controls keep sidecars correct while omitting or contradicting explanations, and allow explicit rejection of the prohibited recommendation. The question controls also reject wrong horizons and in-hospital-only endpoints. These are bounded checks, not a general semantic contradiction detector or complete Python analysis. + +The R setup action is pinned to the official v2 commit `f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05`. Both CI jobs have explicit read permissions; the test job no longer inherits the observed write-token default. Four nontrivial inspection/audit helper contracts were documented. Eight scoped Ruff diagnostics were corrected; seven pre-existing diagnostics outside those blocks remain. The bot's 16-function documentation percentage was not independently reproduced. Its escaped-constant-regex, web `jsonify`, batch-label spelling and generic destructive-operation warnings did not identify a source defect requiring their suggested changes. + +## Executable verification + +- Full `bun test`: **1,853 pass, five optional skips, zero failures**, 14,142 assertions across 123 files after the endpoint-grader correction. +- `bun run typecheck`, `bun run release:validate`, `bun run plugin:validate`, `bun run eval:validate` (39 cases), and whitespace checks pass. +- Written-advice negative/positive controls: seven tests, 100 assertions pass. Skill-creator eval-set contracts: nine tests pass. The original three scenarios and balanced 20-query trigger sets are retained. +- Python 3.12 and the temporary R library from the prior correction pass were reused. No system or lockfile changes were needed. Five skips require unrelated website, trial-engine, Parquet, workbook-rendering or Python numerical dependencies. No browser surface changed. + +## Fresh-context acceptance + +All **18 acceptance runs across nine cases pass every hard gate**, two independent generic contexts per case. Each used the system skill-creator forward-testing workflow, current on-disk source injection and explicit Codex `gpt-6.1-sol` options (`reasoningEffort=xhigh`, `serviceTier=default`). Inputs were prepared and hashed before dispatch; completion and scoring did not refresh those hashes. Acceptance digests still match the final case, prompt and whole target directory. + +- `method-cohort-baseline-observability`: 18/18, 18/18; all hard gates pass. +- `method-model-choice-forward-time`: 26/26, 26/26; all hard gates pass. +- `method-meta-compatible-anchor`: 12/12, 12/12; all hard gates pass. +- `method-question-indicated-bundle`: 28/28, 28/28; all hard gates pass. +- `method-model-choice-ml-prediction`: 95/95, 93/95; all hard gates pass. +- `method-omics-qc-hidden-aliasing`: 22/22, 22/22; all hard gates pass. +- `method-meta-uncertainty-contract`: 36/36, 36/36; all hard gates pass. +- `method-genome-build-evidence`: 28/28, 28/28; all hard gates pass. +- `method-verify-test-contract`: 20/20, 20/20; all hard gates pass. + +One accepted ML run scored 93/95 because the soft AUPRC grammar flagged "Do not label AUPRC the primary metric." Direct inspection confirms this is a refusal, not a primary-metric recommendation. The bounded vocabulary does not recognize that frame. The run passes every hard gate and its frozen weighted threshold; its original score and warning remain unchanged. No perfect score is claimed. + +All **36 launches** are preserved: 32 passed and four failed. Two question runs correctly described the endpoint or ascertainment but failed overly literal wording checks ("All-cause death within 30 days" and "after discharge"). One ML run used a scientifically compliant buffered fold-record layout outside the static check's supported forms. Another correctly described Riley sizing and its assumptions beyond an arbitrary 400-character proximity limit. Both also received false warnings for explicitly rejecting AUPRC as primary. Those reports remain unchanged. The bounded prose grammar now preserves ordinary negated use/declaration/establishment and contrastive "not only" correctly. The sample-size gate still requires the sizing method and performance/shrinkage assumptions, without an arbitrary character-distance limit. The ML fixture explicitly requests module-level imports and direct/cached split-pair assessment loops; the AST check and leakage gates were not relaxed. Isolated copies of the unsupported scaffold confirm that the declared layout passes and a held-out fit still fails. The final question pair is retained; two new contexts each cover ML and the omics case affected by the final shared negation grammar. The same artifact/agreement condition also covers the unflagged uncertainty, genome and statistical cases, each with a new pair. + +This is a narrower, explicit scaffold-layout contract, not proof that arbitrary compliant Python layouts are recognized. The approach was adjudicated against the published bounded-checker contract before implementation. The earlier 36-run evidence manifest remains unchanged and describes its earlier candidate. + +The [sanitized evidence manifest](2026-10-27-pr173-feedback-evidence.json) records paths, pre-dispatch digests, artifact hashes, scores, historical failures and limitations. Full responses and model workspaces remain under `/tmp/methodsmith/behavioral-evals/`; they are not committed. Two observations per case do not establish a reliable error rate, comprehensive scientific accuracy or clinical validity. No clinical model was fitted by these advisory evaluations. + +## Advisory limit and publication boundary + +The Jev gate received the unabridged code/test/eval patch, but reported service truncation and `escalate`: composite 0.5165, safe-to-apply 0.40. Two claims were verified, two unsupported and none contradicted, all below automatic acceptance. It identified no concrete additional defect, was not retried, and is not counted as a passing gate. Later bounded grader corrections and evidence documentation are outside that advisory snapshot; an earlier separate verification of bounded source/check claims verified three (support probabilities 0.97, 1.00 and 1.00). A final verification of the last grader correction returned one verified and two contradicted claims, all at review status (confidence 0.40, 0.69 and 0.79). Its evidence mixed historical red and current green checks and omitted the exact sample-size criterion. Direct reinspection of that criterion and the negation grammar, plus a targeted rerun (two tests, 20 assertions), confirmed the claimed current behavior. The advisory remains unresolved, was not retried and is not counted as a passing full-patch gate. + +Publication and conversation readbacks are recorded in the resolver handoff under `/tmp/methodsmith/scientific-fixes/20261027-pr173-review/`. Merge, history rewrites, branch-currency updates, CI approval and PR watching remain outside this batch. The caller owns subsequent CI/review monitoring and any new feedback. diff --git a/docs/solutions/skill-design/behavioral-evaluation.md b/docs/solutions/skill-design/behavioral-evaluation.md index 08db9a7a..2a077fd3 100644 --- a/docs/solutions/skill-design/behavioral-evaluation.md +++ b/docs/solutions/skill-design/behavioral-evaluation.md @@ -224,6 +224,8 @@ statistical, or production validity. supported adverbs before `be`. `not only`, `not merely`, and `not just` are contrastive frames, not ordinary negations. Keep subject and claim lists literal and narrow, and use the single `negation_pattern` only for explicit disclaimers. + Negated reporting frames include instructions not to use a measure and evidence that does + not establish a claim; contrastive "not only" frames remain affirmative. - Use numeric tolerances only where formatting or floating-point representation can vary. - Make prohibited behaviors hard gates when violating them could silently mutate data, expose sensitive text, invent analysis results, or bypass required user judgment. @@ -287,6 +289,10 @@ model, correct calibration, or clinical validity. Unsupported compliant layouts Archive compatibility was checked on isolated copies through `scoreEvaluationRun`, not by rewriting original run digests or regrading published reports. +The ML fixture requests module-level imports and explicit assessment loops over splitter +outputs or cached split pairs. A loop over enriched records assembled by a separate preflight +loop remains unsupported. Its acceptance claims are limited to that declared layout. + This pattern adapts the frozen protocols, objective scoring, synthetic health-data cases, and hash-based evidence used in [`bojieli/ai-agent-book`](https://github.com/bojieli/ai-agent-book), especially its diff --git a/evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml b/evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml index a52e2831..358b97bd 100644 --- a/evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml +++ b/evals/methodsmith/cases/method-cohort-baseline-observability/case.yaml @@ -11,10 +11,16 @@ "fixtures": [], "required_behaviors": [ "eligible-at-index", - "review-informative-censoring" + "review-informative-censoring", + "written-response", + "response-agrees-eligible-at-index", + "response-agrees-requires-full-future-enrollment", + "response-agrees-review-informative-censoring", + "explains-followup" ], "prohibited_behaviors": [ - "requires-full-future-enrollment" + "requires-full-future-enrollment", + "no-post-index-exclusion" ], "criteria": [ { @@ -46,10 +52,71 @@ "expected": true, "weight": 2, "hard_gate": true + }, + { + "id": "written-response", + "description": "The requested explanation exists.", + "type": "file_exists", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "expected": true + }, + { + "id": "response-agrees-eligible-at-index", + "description": "The unique written decision agrees with the sidecar: eligible_at_index", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "eligible_at_index", + "text_path": "response.md", + "pattern": "^eligible_at_index:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-requires-full-future-enrollment", + "description": "The unique written decision agrees with the sidecar: requires_full_future_enrollment", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "requires_full_future_enrollment", + "text_path": "response.md", + "pattern": "^requires_full_future_enrollment:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-review-informative-censoring", + "description": "The unique written decision agrees with the sidecar: review_informative_censoring", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "review_informative_censoring", + "text_path": "response.md", + "pattern": "^review_informative_censoring:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "explains-followup", + "description": "Explains censoring and follow-up after index.", + "type": "regex", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "\\b(?:censor\\w*|follow[- ]?up|ascertain\\w*)\\b" + }, + { + "id": "no-post-index-exclusion", + "description": "Reject affirmative exclusion of this patient on future enrollment.", + "type": "regex_not", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?:^|[.!?;\\n])\\s*(?:we\\s+)?(?:recommend\\s+(?:that\\s+)?(?:we\\s+)?)?exclude\\s+(?:the\\s+)?(?:day[- ]?90\\s+(?:patient|person)|(?:patient|person)\\s+who\\s+disenrolls)" } ], "threshold": 1, "limitations": [ - "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests.", + "Written decisions are bound to the JSON sidecar; prose gates cover bounded terms and explicit prohibited recommendations, not arbitrary semantic contradictions." ] } diff --git a/evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md b/evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md index 137dd5cc..1f666104 100644 --- a/evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md +++ b/evals/methodsmith/cases/method-cohort-baseline-observability/prompt.md @@ -1 +1 @@ -Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable. Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain followup handling and why the outcome's observability differs from baseline eligibility in response.md. No network or package installation. +Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day 90. Does this person belong in the inception cohort for one-year outcomes? Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain baseline eligibility and follow-up handling in response.md. No network or package installation. In response.md, include exactly one plain decision line per advice.json field using field_name: value, followed by the requested explanation. diff --git a/evals/methodsmith/cases/method-genome-build-evidence/case.yaml b/evals/methodsmith/cases/method-genome-build-evidence/case.yaml index 3088587a..84cd7991 100644 --- a/evals/methodsmith/cases/method-genome-build-evidence/case.yaml +++ b/evals/methodsmith/cases/method-genome-build-evidence/case.yaml @@ -12,7 +12,17 @@ "required_behaviors": [ "mismatch-status", "no-evidence-status", - "unavailable-tool-status" + "unavailable-tool-status", + "naming-identifies-build", + "p1-blocks-clean-audit", + "written-response", + "response-agrees-mismatch-status", + "response-agrees-no-evidence-status", + "response-agrees-unavailable-tool-status", + "response-agrees-ready", + "response-agrees-naming-identifies-build", + "response-agrees-p1-blocks-clean-audit", + "explains-evidence" ], "prohibited_behaviors": [ "ready" @@ -57,10 +67,115 @@ "expected": false, "weight": 2, "hard_gate": true + }, + { + "id": "naming-identifies-build", + "description": " Also assess whether contig naming alone identifies a build and whether a P1 naming issue blocks clean audit completion", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "naming_identifies_build", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "p1-blocks-clean-audit", + "description": " Also assess whether contig naming alone identifies a build and whether a P1 naming issue blocks clean audit completion", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "p1_blocks_clean_audit", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "written-response", + "description": "The requested explanation exists.", + "type": "file_exists", + "path": "response.md", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-mismatch-status", + "description": "The unique written decision agrees with the sidecar: mismatch_status", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "mismatch_status", + "text_path": "response.md", + "pattern": "^mismatch_status:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-no-evidence-status", + "description": "The unique written decision agrees with the sidecar: no_evidence_status", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "no_evidence_status", + "text_path": "response.md", + "pattern": "^no_evidence_status:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-unavailable-tool-status", + "description": "The unique written decision agrees with the sidecar: unavailable_tool_status", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "unavailable_tool_status", + "text_path": "response.md", + "pattern": "^unavailable_tool_status:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-ready", + "description": "The unique written decision agrees with the sidecar: ready", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "ready", + "text_path": "response.md", + "pattern": "^ready:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-naming-identifies-build", + "description": "The unique written decision agrees with the sidecar: naming_identifies_build", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "naming_identifies_build", + "text_path": "response.md", + "pattern": "^naming_identifies_build:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-p1-blocks-clean-audit", + "description": "The unique written decision agrees with the sidecar: p1_blocks_clean_audit", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "p1_blocks_clean_audit", + "text_path": "response.md", + "pattern": "^p1_blocks_clean_audit:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "explains-evidence", + "description": "Includes the requested scientific explanation, beyond decision rows.", + "type": "regex", + "path": "response.md", + "pattern": "\\b(?:header|reference|assembly|checksum|sequence)\\b", + "weight": 2, + "hard_gate": true } ], "threshold": 1, "limitations": [ - "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests.", + "Canonical written decisions are bound to the sidecar; bounded explanation terms are not a general semantic contradiction detector." ] } diff --git a/evals/methodsmith/cases/method-genome-build-evidence/prompt.md b/evals/methodsmith/cases/method-genome-build-evidence/prompt.md index 38ef1db4..75fc38b9 100644 --- a/evals/methodsmith/cases/method-genome-build-evidence/prompt.md +++ b/evals/methodsmith/cases/method-genome-build-evidence/prompt.md @@ -1 +1 @@ -Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each. Write workspace/advice.json with mismatch_status, no_evidence_status, unavailable_tool_status and ready (boolean). Do not install tools or infer a build from the chr prefix. Save the full explanation in response.md. +Use method-genome-build to check this synthetic header-only example against declared GRCh38: ##reference=GRCh37 and ##contig=. There is no MD5. A second file has only ##contig=, and a BAM could not be inspected because samtools is absent. No patient or genomic sequence data are supplied. Decide whether a clean audit is justified for each. Write workspace/advice.json with mismatch_status, no_evidence_status, unavailable_tool_status and ready (boolean). Do not install tools or infer a build from the chr prefix. Save the full explanation in response.md. Also assess whether contig naming alone identifies a build and whether a P1 naming issue blocks clean audit completion. Add booleans naming_identifies_build and p1_blocks_clean_audit to the advice. In response.md, include exactly one plain decision line per advice.json field using field_name: value, followed by the requested explanation. diff --git a/evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml b/evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml index 264d6466..041ff7b7 100644 --- a/evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml +++ b/evals/methodsmith/cases/method-meta-uncertainty-contract/case.yaml @@ -14,7 +14,19 @@ "t9-eligible", "profile-eligible", "reported-log-se-eligible", - "invent-symmetric-interval" + "invent-symmetric-interval", + "ratio-ci-se-scale", + "normal-wald-requires-df", + "written-response", + "response-agrees-normal90-eligible", + "response-agrees-t9-eligible", + "response-agrees-unknown-eligible", + "response-agrees-profile-eligible", + "response-agrees-reported-log-se-eligible", + "response-agrees-invent-symmetric-interval", + "response-agrees-ratio-ci-se-scale", + "response-agrees-normal-wald-requires-df", + "explains-evidence" ], "prohibited_behaviors": [ "unknown-eligible" @@ -79,10 +91,137 @@ "expected": false, "weight": 2, "hard_gate": true + }, + { + "id": "ratio-ci-se-scale", + "description": " For a ratio metric, identify the scale used for CI midpoint tolerance and CI-to-SE reconstruction", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "ratio_ci_se_scale", + "expected": "log", + "weight": 2, + "hard_gate": true + }, + { + "id": "normal-wald-requires-df", + "description": " For a ratio metric, identify the scale used for CI midpoint tolerance and CI-to-SE reconstruction", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "normal_wald_requires_df", + "expected": false, + "weight": 2, + "hard_gate": true + }, + { + "id": "written-response", + "description": "The requested explanation exists.", + "type": "file_exists", + "path": "response.md", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-normal90-eligible", + "description": "The unique written decision agrees with the sidecar: normal90_eligible", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "normal90_eligible", + "text_path": "response.md", + "pattern": "^normal90_eligible:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-t9-eligible", + "description": "The unique written decision agrees with the sidecar: t9_eligible", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "t9_eligible", + "text_path": "response.md", + "pattern": "^t9_eligible:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-unknown-eligible", + "description": "The unique written decision agrees with the sidecar: unknown_eligible", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "unknown_eligible", + "text_path": "response.md", + "pattern": "^unknown_eligible:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-profile-eligible", + "description": "The unique written decision agrees with the sidecar: profile_eligible", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "profile_eligible", + "text_path": "response.md", + "pattern": "^profile_eligible:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-reported-log-se-eligible", + "description": "The unique written decision agrees with the sidecar: reported_log_se_eligible", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "reported_log_se_eligible", + "text_path": "response.md", + "pattern": "^reported_log_se_eligible:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-invent-symmetric-interval", + "description": "The unique written decision agrees with the sidecar: invent_symmetric_interval", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "invent_symmetric_interval", + "text_path": "response.md", + "pattern": "^invent_symmetric_interval:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-ratio-ci-se-scale", + "description": "The unique written decision agrees with the sidecar: ratio_ci_se_scale", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "ratio_ci_se_scale", + "text_path": "response.md", + "pattern": "^ratio_ci_se_scale:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-normal-wald-requires-df", + "description": "The unique written decision agrees with the sidecar: normal_wald_requires_df", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "normal_wald_requires_df", + "text_path": "response.md", + "pattern": "^normal_wald_requires_df:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "explains-evidence", + "description": "Includes the requested scientific explanation, beyond decision rows.", + "type": "regex", + "path": "response.md", + "pattern": "\\b(?:source|table|confidence|Wald)\\b", + "weight": 2, + "hard_gate": true } ], "threshold": 1, "limitations": [ - "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests.", + "Canonical written decisions are bound to the sidecar; bounded explanation terms are not a general semantic contradiction detector." ] } diff --git a/evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md b/evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md index 94cf49ba..8ae75432 100644 --- a/evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md +++ b/evals/methodsmith/cases/method-meta-uncertainty-contract/prompt.md @@ -1 +1 @@ -Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network. +Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network. For a ratio metric, identify the scale used for CI midpoint tolerance and CI-to-SE reconstruction. State whether a normal-Wald interval requires degrees of freedom. Add string ratio_ci_se_scale and boolean normal_wald_requires_df to the advice. In response.md, include exactly one plain decision line per advice.json field using field_name: value, followed by the requested explanation. diff --git a/evals/methodsmith/cases/method-model-choice-forward-time/case.yaml b/evals/methodsmith/cases/method-model-choice-forward-time/case.yaml index 87c0e8e0..c3455609 100644 --- a/evals/methodsmith/cases/method-model-choice-forward-time/case.yaml +++ b/evals/methodsmith/cases/method-model-choice-forward-time/case.yaml @@ -12,10 +12,19 @@ "required_behaviors": [ "period-transport-is-forward-validation", "review-outcome-maturation-gap", - "group-patient-encounters" + "group-patient-encounters", + "single-later-cohort-valid", + "written-response", + "response-agrees-uses-future-training", + "response-agrees-period-transport-is-forward-validation", + "response-agrees-review-outcome-maturation-gap", + "response-agrees-group-patient-encounters", + "response-agrees-single-later-cohort-valid", + "explains-forward-split" ], "prohibited_behaviors": [ - "uses-future-training" + "uses-future-training", + "no-random-deployment-split" ], "criteria": [ { @@ -57,10 +66,103 @@ "expected": true, "weight": 2, "hard_gate": true + }, + { + "id": "single-later-cohort-valid", + "description": "A frozen model can use one independent later validation cohort.", + "type": "json_equals", + "path": "workspace/advice.json", + "json_path": "single_later_cohort_valid", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "written-response", + "description": "The requested explanation exists.", + "type": "file_exists", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "expected": true + }, + { + "id": "response-agrees-uses-future-training", + "description": "The unique written decision agrees with the sidecar: uses_future_training", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "uses_future_training", + "text_path": "response.md", + "pattern": "^uses_future_training:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-period-transport-is-forward-validation", + "description": "The unique written decision agrees with the sidecar: period_transport_is_forward_validation", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "period_transport_is_forward_validation", + "text_path": "response.md", + "pattern": "^period_transport_is_forward_validation:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-review-outcome-maturation-gap", + "description": "The unique written decision agrees with the sidecar: review_outcome_maturation_gap", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "review_outcome_maturation_gap", + "text_path": "response.md", + "pattern": "^review_outcome_maturation_gap:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-group-patient-encounters", + "description": "The unique written decision agrees with the sidecar: group_patient_encounters", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "group_patient_encounters", + "text_path": "response.md", + "pattern": "^group_patient_encounters:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-single-later-cohort-valid", + "description": "The unique written decision agrees with the sidecar: single_later_cohort_valid", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "single_later_cohort_valid", + "text_path": "response.md", + "pattern": "^single_later_cohort_valid:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "explains-forward-split", + "description": "Recommends earlier development and later assessment.", + "type": "regex", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?:earlier|prior|past)[^.!?\\n]{0,180}(?:later|subsequent|future)" + }, + { + "id": "no-random-deployment-split", + "description": "Reject an affirmative random-split recommendation for future deployment.", + "type": "regex_not", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?:^|[.!?;\\n])\\s*(?:we\\s+)?(?:recommend|use|choose|adopt)\\s+(?:a\\s+)?(?:random|shuffled)\\s+(?:split|cross[- ]validation)" } ], "threshold": 1, "limitations": [ - "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests.", + "Written decisions are bound to the JSON sidecar; prose gates cover bounded terms and explicit prohibited recommendations, not arbitrary semantic contradictions." ] } diff --git a/evals/methodsmith/cases/method-model-choice-forward-time/prompt.md b/evals/methodsmith/cases/method-model-choice-forward-time/prompt.md index d9ad3c67..ca7b6237 100644 --- a/evals/methodsmith/cases/method-model-choice-forward-time/prompt.md +++ b/evals/methodsmith/cases/method-model-choice-forward-time/prompt.md @@ -1 +1 @@ -Review only the validation component of a binary clinical prediction strategy using method-model-choice. We want performance for future deployment. Data periods are 2020, 2021 and 2022; outcomes take 90 days to mature and patients can have repeated encounters. A collaborator proposes LeaveOneGroupOut on calendar year, training on every other year to assess the left-out year. No model fit or scaffold is requested. Write workspace/advice.json with booleans uses_future_training (for your recommended forward-validation design), period_transport_is_forward_validation, review_outcome_maturation_gap, group_patient_encounters. State the corrected split rule and distinguish the collaborator's period-transport target in response.md. No network or package installation. +Review only the validation component of a binary clinical prediction strategy using method-model-choice. We want performance for future deployment. Data periods are 2020, 2021 and 2022; outcomes take 90 days to mature and patients can have repeated encounters. A collaborator proposes LeaveOneGroupOut on calendar year, training on every other year to assess the left-out year. No model fit or scaffold is requested. Write workspace/advice.json with booleans uses_future_training (for your recommended forward-validation design), period_transport_is_forward_validation, review_outcome_maturation_gap, group_patient_encounters, single_later_cohort_valid. Also assess whether a model frozen after development in 2020-2021 can be assessed solely in an independent 2022 cohort without retraining. State the corrected split rule and distinguish the collaborator's period-transport target in response.md. No network or package installation. In response.md, include exactly one plain decision line per advice.json field using field_name: value, followed by the requested explanation. diff --git a/evals/methodsmith/cases/method-model-choice-ml-prediction/case.yaml b/evals/methodsmith/cases/method-model-choice-ml-prediction/case.yaml index 618369fb..cadedd05 100644 --- a/evals/methodsmith/cases/method-model-choice-ml-prediction/case.yaml +++ b/evals/methodsmith/cases/method-model-choice-ml-prediction/case.yaml @@ -52,6 +52,7 @@ required_behaviors: - evidence-ledger-preserved - emits-handoff prohibited_behaviors: + - no-primary-auprc-declaration - no-fabricated-metrics - no-imbalance-correction - no-cuda-install-plan @@ -218,11 +219,22 @@ criteria: hard_gate: true - id: auprc-supplementary-only description: The memo does not make AUPRC or average precision the primary measure. - type: regex_not + type: claim_absent path: workspace/analysis/model-strategy/sepsis-48h-model-strategy.md - pattern: 'primary (?:performance )?(?:metric|measure)\W{0,4}(?:is |will be )?(?:the )?(?:AUPRC|PR.?AUC|average precision)|(?:AUPRC|PR.?AUC|average precision)[^.\n]{0,20}\b(?:as|is) (?:the )?primary' + subjects: [AUPRC, PR-AUC, PR AUC, average precision] + claims: [primary] + negation_pattern: '\b(?:not|never|cannot|can''t|isn''t|aren''t|don''t|doesn''t)\b' weight: 2 hard_gate: false + - id: no-primary-auprc-declaration + description: An affirmative primary-measure declaration does not name AUPRC. + type: claim_absent + path: workspace/analysis/model-strategy/sepsis-48h-model-strategy.md + subjects: [primary metric, primary performance metric, primary measure, primary performance measure, primary objective] + claims: [AUPRC, PR-AUC, PR AUC, average precision] + negation_pattern: '\b(?:not|never|cannot|can''t|isn''t|aren''t|don''t|doesn''t)\b' + weight: 1 + hard_gate: false - id: proper-tuning-objective description: Hyperparameters are tuned on a proper scoring rule (log loss or Brier). type: regex @@ -234,7 +246,7 @@ criteria: description: The memo grounds a real Riley sample-size check in its machinery (shrinkage, Nagelkerke R-squared, or pmsampsize near the Riley reference), not a bare keyword. type: regex path: workspace/analysis/model-strategy/sepsis-48h-model-strategy.md - pattern: '(?:Riley|pmsampsize)[\s\S]{0,400}(?:shrinkage|Nagelkerke|R.?squared|Cox.?Snell|R\^\{?2\}?|R\u00B2)|(?:shrinkage|Nagelkerke|R.?squared|Cox.?Snell|R\^\{?2\}?|R\u00B2)[\s\S]{0,400}(?:Riley|pmsampsize)' + pattern: '(?=[\s\S]*(?:Riley|pmsampsize))(?=[\s\S]*(?:shrinkage|Nagelkerke|R.?squared|Cox.?Snell|R\^\{?2\}?|R\u00B2))' weight: 2 hard_gate: true - id: validation-design-declared @@ -391,4 +403,5 @@ limitations: - The sidecar cannot establish scaffold correctness. The structural tuning gate parses supported Python shapes and follows bounded data flow; it is not execution, full control-flow analysis, or a statistical code audit. - The fixture is synthetic and aggregate; the case evaluates protocol routing and scaffold structure, not fitted results or clinical validity. - Regex criteria verify that the right concepts are named, not that the reasoning is complete; a human reviewer still reads the memo. - - The auprc-supplementary-only check is a heuristic phrase match and is not a hard gate. + - The AUPRC claim checks use bounded clause/negation grammar and are not hard gates. + - This fixture requests explicit loops over splitter outputs or simple cached split pairs. Enriched fold-record buffers, dynamic dispatch and other unsupported containers remain outside the static check. diff --git a/evals/methodsmith/cases/method-model-choice-ml-prediction/prompt.md b/evals/methodsmith/cases/method-model-choice-ml-prediction/prompt.md index 3fcad183..956d4e62 100644 --- a/evals/methodsmith/cases/method-model-choice-ml-prediction/prompt.md +++ b/evals/methodsmith/cases/method-model-choice-ml-prediction/prompt.md @@ -11,4 +11,8 @@ explainability figures will be produced. Use the stable slug `sepsis-48h`. Write the memo and, only if permitted by the status gate, one Python scaffold under `workspace/analysis/model-strategy/`. Include the prediction decision sidecar required by the skill. +Keep the scaffold's training/assessment data flow easy to audit: iterate directly +over the splitter outputs or a cached list of those split pairs. Keep preflight +checks separate, without replacing the assessment iterator with enriched fold records. +Keep library imports at module scope so their bindings are visible during review. Save the complete user-facing response to `response.md` and emit the terminal handoff. diff --git a/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml index 79895c6b..5eb32e5d 100644 --- a/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml +++ b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/case.yaml @@ -12,10 +12,17 @@ "required_behaviors": [ "qc-pass", "batch-deletion-establishes-validity", - "rank-check-required-without-pc-separation" + "rank-check-required-without-pc-separation", + "written-response", + "response-agrees-design-identifiable", + "response-agrees-qc-pass", + "response-agrees-batch-deletion-establishes-validity", + "response-agrees-rank-check-required-without-pc-separation", + "explains-estimability" ], "prohibited_behaviors": [ - "design-identifiable" + "design-identifiable", + "no-deletion-validity-claim" ], "criteria": [ { @@ -57,10 +64,95 @@ "expected": true, "weight": 2, "hard_gate": true + }, + { + "id": "written-response", + "description": "The requested explanation exists.", + "type": "file_exists", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "expected": true + }, + { + "id": "response-agrees-design-identifiable", + "description": "The unique written decision agrees with the sidecar: design_identifiable", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "design_identifiable", + "text_path": "response.md", + "pattern": "^design_identifiable:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-qc-pass", + "description": "The unique written decision agrees with the sidecar: qc_pass", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "qc_pass", + "text_path": "response.md", + "pattern": "^qc_pass:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-batch-deletion-establishes-validity", + "description": "The unique written decision agrees with the sidecar: batch_deletion_establishes_validity", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "batch_deletion_establishes_validity", + "text_path": "response.md", + "pattern": "^batch_deletion_establishes_validity:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-rank-check-required-without-pc-separation", + "description": "The unique written decision agrees with the sidecar: rank_check_required_without_pc_separation", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "rank_check_required_without_pc_separation", + "text_path": "response.md", + "pattern": "^rank_check_required_without_pc_separation:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "explains-estimability", + "description": "Explains the aliased condition contrast.", + "type": "regex", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?:not\\s+estimable|non[- ]?identifi\\w*|alias\\w*|confound\\w*|rank[- ]deficien\\w*)" + }, + { + "id": "no-deletion-validity-claim", + "description": "Batch deletion cannot establish publication validity.", + "type": "claim_absent", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "subjects": [ + "batch deletion", + "deleting one batch", + "deleting a batch", + "removing one batch" + ], + "claims": [ + "validates", + "establishes validity", + "valid for publication", + "publication-ready", + "publishable" + ], + "negation_pattern": "\\b(?:not|never|cannot|doesn.t|does not)\\b" } ], "threshold": 1, "limitations": [ - "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests.", + "Written decisions are bound to the JSON sidecar; prose gates cover bounded terms and explicit prohibited recommendations, not arbitrary semantic contradictions." ] } diff --git a/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md index 493aabd0..acca5478 100644 --- a/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md +++ b/evals/methodsmith/cases/method-omics-qc-hidden-aliasing/prompt.md @@ -1 +1 @@ -Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC. Write workspace/advice.json with booleans design_identifiable, qc_pass, batch_deletion_establishes_validity, rank_check_required_without_pc_separation. Explain estimability and the scope of any alternative comparison in response.md. Do not run DE or correction; no network. +Use method-omics-qc for a synthetic design-only check before differential expression. Batch1 contains four controls and no cases; batch2 contains four cases and no controls. PC1/PC2 show unrelated nuisance variation and no visible batch separation. A collaborator says to skip the rank check and publish if estimates remain stable after deleting one batch. No assay data or tools are available; do not invent executed QC. Write workspace/advice.json with booleans design_identifiable, qc_pass, batch_deletion_establishes_validity, rank_check_required_without_pc_separation. Explain estimability and the scope of any alternative comparison in response.md. Do not run DE or correction; no network. In response.md, include exactly one plain decision line per advice.json field using field_name: value, followed by the requested explanation. diff --git a/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml b/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml index 49a621b4..18d4b6ce 100644 --- a/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml +++ b/evals/methodsmith/cases/method-question-indicated-bundle/case.yaml @@ -12,10 +12,20 @@ "required_behaviors": [ "requires-all-five-completed-one-hour", "mortality-endpoint", - "post-discharge-ascertainment" + "post-discharge-ascertainment", + "written-response", + "response-agrees-unindicated-pressors-fail-adherence", + "response-agrees-requires-all-five-completed-one-hour", + "response-agrees-mortality-ascertainment-includes-post-discharge", + "response-agrees-mortality-endpoint", + "written-pico", + "written-indications", + "written-ascertainment", + "written-mortality-endpoint" ], "prohibited_behaviors": [ - "unindicated-pressors-fail-adherence" + "unindicated-pressors-fail-adherence", + "no-all-five-completion" ], "criteria": [ { @@ -56,10 +66,109 @@ "expected": true, "weight": 2, "hard_gate": true + }, + { + "id": "written-response", + "description": "The requested explanation exists.", + "type": "file_exists", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "expected": true + }, + { + "id": "response-agrees-unindicated-pressors-fail-adherence", + "description": "The unique written decision agrees with the sidecar: unindicated_pressors_fail_adherence", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "unindicated_pressors_fail_adherence", + "text_path": "response.md", + "pattern": "^unindicated_pressors_fail_adherence:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-requires-all-five-completed-one-hour", + "description": "The unique written decision agrees with the sidecar: requires_all_five_completed_one_hour", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "requires_all_five_completed_one_hour", + "text_path": "response.md", + "pattern": "^requires_all_five_completed_one_hour:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-mortality-ascertainment-includes-post-discharge", + "description": "The unique written decision agrees with the sidecar: mortality_ascertainment_includes_post_discharge", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "mortality_ascertainment_includes_post_discharge", + "text_path": "response.md", + "pattern": "^mortality_ascertainment_includes_post_discharge:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-mortality-endpoint", + "description": "The written endpoint agrees with the sidecar.", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "mortality_endpoint", + "text_path": "response.md", + "pattern": "^mortality_endpoint:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "written-pico", + "description": "Includes the revised population, exposure, comparator and outcome.", + "type": "regex", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?=[\\s\\S]*\\bpopulation\\s*:)(?=[\\s\\S]*\\b(?:exposure|intervention)\\s*:)(?=[\\s\\S]*\\bcomparator\\s*:)(?=[\\s\\S]*\\boutcome\\s*:)" + }, + { + "id": "written-indications", + "description": "Explains conditional indications and initiation.", + "type": "regex", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?=[\\s\\S]*\\b(?:initiat\\w*|start\\w*)\\b)(?=[\\s\\S]*\\b(?:hypotens\\w*|lactate)\\b)(?=[\\s\\S]*\\b(?:vasopressor\\w*|pressor\\w*)\\b)" + }, + { + "id": "written-ascertainment", + "description": "Names post-discharge vital-status ascertainment.", + "type": "regex", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?=[\\s\\S]*\\b30[- ]day\\s+all[- ]cause\\s+mortality\\b)(?=[\\s\\S]*\\b(?:post[- ](?:hospital[- ])?discharge|(?:after|following)\\s+(?:hospital\\s+)?discharge)\\b)(?=[\\s\\S]*\\b(?:linked|vital[- ]status|ascertain\\w*)\\b)" + }, + { + "id": "no-all-five-completion", + "description": "Reject a blanket one-hour completion requirement.", + "type": "regex_not", + "path": "response.md", + "weight": 2, + "hard_gate": true, + "pattern": "(?:^|[.!?;\\n])\\s*all\\s+five\\s+(?:actions|components|interventions)\\s+(?:must|are required to)\\s+be\\s+completed\\s+(?:within|in)\\s+(?:one|1)\\s+hour" + }, + { + "id": "written-mortality-endpoint", + "description": "The PICO outcome names 30-day all-cause mortality.", + "type": "regex", + "path": "response.md", + "pattern": "\\bOutcome(?:\\*\\*)?\\s*:(?:\\*\\*)?[^\\n]{0,100}(?:\\b30[- ]day\\s+all[- ]cause\\s+(?:mortality|death)\\b|\\ball[- ]cause\\s+(?:death|mortality)\\s+(?:within|by|at)\\s+(?:30\\s+days|day\\s+30)\\b)", + "weight": 2, + "hard_gate": true } ], "threshold": 1, "limitations": [ - "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests.", + "Written decisions are bound to the JSON sidecar; prose gates cover bounded terms and explicit prohibited recommendations, not arbitrary semantic contradictions." ] } diff --git a/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md b/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md index 5a3e8a28..249a189b 100644 --- a/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md +++ b/evals/methodsmith/cases/method-question-indicated-bundle/prompt.md @@ -1 +1 @@ -Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, mortality_ascertainment_includes_post_discharge, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md. +Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, mortality_ascertainment_includes_post_discharge, and string mortality_endpoint. Give the revised PICO with Population, Exposure, Comparator and Outcome labels, plus exposure rules and ascertainment in response.md. In response.md, include exactly one plain decision line per advice.json field using field_name: value, followed by the requested explanation. diff --git a/evals/methodsmith/cases/method-verify-test-contract/case.yaml b/evals/methodsmith/cases/method-verify-test-contract/case.yaml index 16c03f2d..4e71aaad 100644 --- a/evals/methodsmith/cases/method-verify-test-contract/case.yaml +++ b/evals/methodsmith/cases/method-verify-test-contract/case.yaml @@ -12,7 +12,13 @@ "required_behaviors": [ "incorrect-negative", "noninferiority", - "sequential" + "sequential", + "written-response", + "response-agrees-incorrect-negative", + "response-agrees-noninferiority", + "response-agrees-sequential", + "response-agrees-unknown-sidedness", + "explains-evidence" ], "prohibited_behaviors": [ "unknown-sidedness" @@ -57,10 +63,73 @@ "expected": "WARN", "weight": 2, "hard_gate": true + }, + { + "id": "written-response", + "description": "The requested explanation exists.", + "type": "file_exists", + "path": "response.md", + "expected": true, + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-incorrect-negative", + "description": "The unique written decision agrees with the sidecar: incorrect_negative", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "incorrect_negative", + "text_path": "response.md", + "pattern": "^incorrect_negative:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-noninferiority", + "description": "The unique written decision agrees with the sidecar: noninferiority", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "noninferiority", + "text_path": "response.md", + "pattern": "^noninferiority:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-sequential", + "description": "The unique written decision agrees with the sidecar: sequential", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "sequential", + "text_path": "response.md", + "pattern": "^sequential:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "response-agrees-unknown-sidedness", + "description": "The unique written decision agrees with the sidecar: unknown_sidedness", + "type": "json_text_equals", + "path": "workspace/advice.json", + "json_path": "unknown_sidedness", + "text_path": "response.md", + "pattern": "^unknown_sidedness:[ \\t]*([^\\r\\n]*)\\r?$", + "weight": 2, + "hard_gate": true + }, + { + "id": "explains-evidence", + "description": "Includes the requested scientific explanation, beyond decision rows.", + "type": "regex", + "path": "response.md", + "pattern": "\\b(?:tail|one[- ]sided|two[- ]sided|adjust(?:ed|ment)|rounding|precision|alpha)\\b", + "weight": 2, + "hard_gate": true } ], "threshold": 1, "limitations": [ - "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests." + "Synthetic advisory behavior checks bounded scientific decisions, not clinical validity or comprehensive statistical reliability. Numeric helper behavior is checked separately by executable regression tests.", + "Canonical written decisions are bound to the sidecar; bounded explanation terms are not a general semantic contradiction detector." ] } diff --git a/evals/methodsmith/cases/method-verify-test-contract/prompt.md b/evals/methodsmith/cases/method-verify-test-contract/prompt.md index 0d53572b..7ad5b85f 100644 --- a/evals/methodsmith/cases/method-verify-test-contract/prompt.md +++ b/evals/methodsmith/cases/method-verify-test-contract/prompt.md @@ -1 +1 @@ -Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed. Write workspace/advice.json with status strings incorrect_negative, noninferiority, sequential, unknown_sidedness (PASS/WARN/FAIL). Retain the claims sent to the checker as workspace/stat-claims.json. Save your full response in response.md. +Use method-verify for a synthetic printed-statistic audit. The SAP uses alpha=0.025. Audit these independent claims: (1) ordinary two-sided t=-3.00 with 30 df, reported P=0.500; (2) ordinary upper-tail z=2.05, reported P=0.0202; (3) sequentially adjusted z=2.05, reported P=0.0100; (4) z=2.05 and P=0.0202 with sidedness not established by the SAP. Preserve printed decimal strings. Use the bundled checker rather than fitting models; no data access or network is needed. Write workspace/advice.json with status strings incorrect_negative, noninferiority, sequential, unknown_sidedness (PASS/WARN/FAIL). Retain the claims sent to the checker as workspace/stat-claims.json. Save your full response in response.md. In response.md, include exactly one plain decision line per advice.json field using field_name: value, followed by the requested explanation. diff --git a/evals/methodsmith/skill-creator/method-cohort/evals.json b/evals/methodsmith/skill-creator/method-cohort/evals.json index 615a360e..a0b40924 100644 --- a/evals/methodsmith/skill-creator/method-cohort/evals.json +++ b/evals/methodsmith/skill-creator/method-cohort/evals.json @@ -3,7 +3,7 @@ "evals": [ { "id": 1, - "prompt": "Build the cohort for our new-user statin study: adults with T2DM initiating a statin 2018-2023, OMOP CDM v5.4 with vocabulary release 2024-Q1, index = first statin drug_exposure on/after T2DM diagnosis, exclude T1DM ever and any statin in the prior 365 days, require 365 days of prior observation, 365-day follow-up. stack_profile.data_root is set. Also address this bounded scientific check as part of the assessment: Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day90. We want the inception cohort eligible at initiation, with one-year outcome followup when observable. Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain followup handling and why the outcome's observability differs from baseline eligibility in response.md. No network or package installation.", + "prompt": "Build the cohort for our new-user statin study: adults with T2DM initiating a statin 2018-2023, OMOP CDM v5.4 with vocabulary release 2024-Q1, index = first statin drug_exposure on/after T2DM diagnosis, exclude T1DM ever and any statin in the prior 365 days, require 365 days of prior observation, 365-day follow-up. stack_profile.data_root is set. Also address this bounded scientific check as part of the assessment: Use method-cohort to review this synthetic eligibility rule, without SQL execution or patient data: require 365 days of insurance observation before a qualifying drug initiation, then require continuous enrollment for the full following year. One person satisfies all baseline criteria but disenrolls on day 90. Does this person belong in the inception cohort for one-year outcomes? Write workspace/advice.json with booleans eligible_at_index, requires_full_future_enrollment, review_informative_censoring. Explain baseline eligibility and follow-up handling in response.md. No network or package installation.", "expected_output": "Concept-set YAMLs, a parameterized OMOP CTE SQL file, a CONSORT-style waterfall (md + csv) with small-cell suppression, a cohort spec YAML pinning the vocabulary version, and the __CE_COHORT__ handoff line. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ @@ -15,7 +15,8 @@ "Records each concept set's source as a published algorithm cited by PMID (looked up through the PubMed/Paperclip MCP tools and read before citing) or as project-defined, never a code set asserted from memory", "eligible_at_index is true in the requested structured advice, consistent with the explanation", "requires_full_future_enrollment is false in the requested structured advice, consistent with the explanation", - "review_informative_censoring is true in the requested structured advice, consistent with the explanation" + "review_informative_censoring is true in the requested structured advice, consistent with the explanation", + "The written explanation agrees with structured decisions and explains the applicable scientific rule." ] }, { diff --git a/evals/methodsmith/skill-creator/method-genome-build/evals.json b/evals/methodsmith/skill-creator/method-genome-build/evals.json index 32d4372e..f2af74ae 100644 --- a/evals/methodsmith/skill-creator/method-genome-build/evals.json +++ b/evals/methodsmith/skill-creator/method-genome-build/evals.json @@ -14,7 +14,8 @@ "mismatch_status is \"incompatible\" in the requested structured advice, consistent with the explanation", "no_evidence_status is \"unknown\" in the requested structured advice, consistent with the explanation", "unavailable_tool_status is \"uninspected\" in the requested structured advice, consistent with the explanation", - "ready is false in the requested structured advice, consistent with the explanation" + "ready is false in the requested structured advice, consistent with the explanation", + "Naming alone never identifies a build; every unresolved audit issue, including P1 naming differences, blocks a clean completion." ] }, { diff --git a/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json b/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json index 087ec050..094af67f 100644 --- a/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-genome-build/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Declare the reference genome for our WGS project: refs/Homo_sapiens.GRCh38.dna.primary_assembly.fa and gencode.v44 GTF. Write a manifest with md5s that we commit. How should GRCh37 headers, absent assembly evidence, and unavailable samtools affect a GRCh38 audit?", "should_trigger": true}, + {"query": "Declare the reference genome for our WGS project: refs/Homo_sapiens.GRCh38.dna.primary_assembly.fa and gencode.v44 GTF. Write a manifest with md5s that we commit. How should GRCh37 headers, absent assembly evidence, and unavailable samtools affect a GRCh38 audit? Can naming alone establish an assembly, and do unresolved P1 issues block completion?", "should_trigger": true}, {"query": "reviewer asks 'what genome build did you use' - audit all our bams/vcfs and make a supplementary traceability table proving it", "should_trigger": true}, {"query": "Some of our BED files use 'chr1' and others use '1' and bedtools intersect returns nothing. Check contig naming consistency against the declared build.", "should_trigger": true}, {"query": "Our counts matrix was built with GENCODE 36 but the manifest says 44. How bad is that and what else drifted? Audit the whole project.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-meta-analysis/evals.json b/evals/methodsmith/skill-creator/method-meta-analysis/evals.json index 37112052..c44c0eb0 100644 --- a/evals/methodsmith/skill-creator/method-meta-analysis/evals.json +++ b/evals/methodsmith/skill-creator/method-meta-analysis/evals.json @@ -3,11 +3,11 @@ "evals": [ { "id": 1, - "prompt": "I have analysis/pubmed/sepsis-bundle-methods.csv from method extraction - 14 studies with pmid, year, sample_size, effect_size_reported (mostly hazard ratios like 'HR 0.81 (0.70-0.94)', a few ORs). I need a defensible HR for 90-day mortality to plug into the power calc. --metric hr Also address this bounded scientific check as part of the assessment: Use method-meta-analysis to review uncertainty extraction only; do not pool or install packages. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network.", + "prompt": "I have analysis/pubmed/sepsis-bundle-methods.csv from method extraction - 14 studies with pmid, year, sample_size, effect_size_reported (mostly hazard ratios like 'HR 0.81 (0.70-0.94)', a few ORs). I need a defensible HR for 90-day mortality to plug into the power calc. --metric hr Also address this bounded scientific check as part of the assessment: For the following five-record check only, review uncertainty extraction without pooling those records. Do not install packages for either task. The original HR-table pooling request remains separate. Population, estimand, adjustment, outcome horizon, units and independence have already been reconciled. Five synthetic source records are available: A is an MD with a symmetric 90% normal-Wald CI, level and source table confirmed; B is an MD with a symmetric 95% t-Wald CI and 9 df, source and rounding confirmed; C is an HR whose CI level and construction are unknown; D is an asymmetric profile-likelihood HR interval without a reported SE; E reports the log-HR SE directly as 0.12 with its source. Determine which records have a supported uncertainty-extraction path, not whether they should form a common pool. Write workspace/advice.json with booleans normal90_eligible, t9_eligible, unknown_eligible, profile_eligible, reported_log_se_eligible, and invent_symmetric_interval. Explain required input fields and source checks in response.md. No network.", "expected_output": "Parses and filters to HR studies with source-validated uncertainty (no sample-size cutoff by default), pools on the log scale with random-effects REML and a Hartung-Knapp CI when at least 3 remain, writes the pooled summary, included-studies CSV, and forest plot, and emits the __CE_EFFECT_SIZE__ envelope for method-power. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ - "Reports how many rows failed parsing and how many studies were dropped by the metric and CI filters versus the input N, and does not drop studies by sample size unless the user asks for it as a sensitivity analysis", + "Reports how many rows failed parsing and how many studies were dropped by the metric and validated-uncertainty selection versus the input N, and does not drop studies by sample size unless the user asks for it as a sensitivity analysis", "Saves the parsing step in the project (analysis/effect-size/sepsis-bundle-parse.R or .py plus sepsis-bundle-parsed.csv, with aHR normalised to HR) and runs the bundled pool_effects.R on the parsed CSV, not on the raw methods table", "Pools HRs on the log scale with random-effects REML and reports pooled estimate, 95% CI with its method (Hartung-Knapp-Sidik-Jonkman when tau^2 > 0), 95% prediction interval (t, k-1 df), I^2, and tau^2", "Writes analysis/effect-size/sepsis-bundle-pooled.md and analysis/effect-size/sepsis-bundle-included.csv and references a forest plot at analysis/effect-size/sepsis-bundle-pooled-forest.png", @@ -21,7 +21,8 @@ "profile_eligible is false in the requested structured advice, consistent with the explanation", "reported_log_se_eligible is true in the requested structured advice, consistent with the explanation", "invent_symmetric_interval is false in the requested structured advice, consistent with the explanation", - "Before CI-to-SE reconstruction, confirms confidence level, Wald method and applicable df from the read source; otherwise retains unresolved inputs without pooling them." + "Before CI-to-SE reconstruction, confirms confidence level, Wald method and applicable df from the read source; otherwise retains unresolved inputs without pooling them.", + "For OR/HR/RR, compute CI midpoint discrepancy and reconstructed SE on the log scale; normal-Wald intervals need no degrees of freedom." ] }, { diff --git a/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json b/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json index f5d5a2c7..bc4b13a2 100644 --- a/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-meta-analysis/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Our HR CSV mixes adjusted conditional and unadjusted marginal effects from overlapping cohorts. Can it give the power anchor? Some intervals are 90%, t-based or profile-likelihood, while others report a log SE. Which uncertainty inputs support pooling?", "should_trigger": true}, + {"query": "Our HR CSV mixes adjusted conditional and unadjusted marginal effects from overlapping cohorts. Can it give the power anchor? Some intervals are 90%, t-based or profile-likelihood, while others report a log SE. Which uncertainty inputs support pooling? On which scale should I reconstruct a hazard-ratio SE from a declared Wald interval?", "should_trigger": true}, {"query": "I keep picking the most optimistic OR from the lit for my sample size. Can you take the extracted methods table and give me a defensible pooled estimate with I^2?", "should_trigger": true}, {"query": "method-extract just finished (__CE_METHOD_EXTRACT__ csv=analysis/pubmed/aki-methods.csv n=11). next step: combine the effect estimates for the SAP effect-size assumption", "should_trigger": true}, {"query": "need a forest plot + pooled SMD (hedges g) from the 8 pilot/feasibility studies in analysis/pubmed/cbt-insomnia-methods.csv to justify the detectable difference in my R21", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-model-choice/evals.json b/evals/methodsmith/skill-creator/method-model-choice/evals.json index 2987a835..e6fa5ee9 100644 --- a/evals/methodsmith/skill-creator/method-model-choice/evals.json +++ b/evals/methodsmith/skill-creator/method-model-choice/evals.json @@ -17,7 +17,7 @@ }, { "id": 2, - "prompt": "which model should I use to predict 30-day readmission? haven't looked at the data yet, not sure if it's one row per admission or per patient. The planned use is deployment in future calendar years; distinguish that target from leaving each historical year out while training on all other years.", + "prompt": "which model should I use to predict 30-day readmission? haven't looked at the data yet, not sure if it's one row per admission or per patient. The planned use is deployment in future calendar years; distinguish that target from leaving each historical year out while training on all other years. Also assess whether a frozen model may be validated in one independent later cohort without retraining.", "expected_output": "Does not choose a final model; marks the strategy blocked or provisional because the data grain and estimand are unresolved, asks one decision-changing question, and writes no code scaffold.", "files": [], "expectations": [ @@ -27,7 +27,8 @@ "Lists the exact future QA facts (e.g. grain, repeat admissions per patient) required to promote the recommendation", "Does not open patient-level files merely to avoid asking about the missing design decision", "If writing a prediction strategy memo, writes its version-1.0 decisions.json sidecar with matching blocked/provisional status, null unknowns, and explicit unresolved questions", - "Keeps unresolved grain blocked/provisional and, for future deployment, requires earlier-to-later validation rather than future-to-past training, with patient grouping and outcome-maturation review." + "Keeps unresolved grain blocked/provisional and, for future deployment, requires earlier-to-later validation rather than future-to-past training, with patient grouping and outcome-maturation review.", + "Permits a frozen model on one independent later cohort without retraining while preserving chronology, patient grouping and label availability; written advice agrees with structured decisions when provided." ] }, { diff --git a/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json b/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json index 34d69392..04eb557c 100644 --- a/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json +++ b/evals/methodsmith/skill-creator/method-model-choice/trigger-evals.json @@ -1,5 +1,5 @@ [ - {"query": "Review a repeated-measures model with a patient random intercept plus fully unstructured within-patient residual covariance. For future deployment, may year folds train on future years, and how do 90-day outcomes and repeated patients affect splitting?", "should_trigger": true}, + {"query": "Review a repeated-measures model with a patient random intercept plus fully unstructured within-patient residual covariance. For future deployment, may year folds train on future years, and how do 90-day outcomes and repeated patients affect splitting? May a frozen model use a single independent later validation cohort?", "should_trigger": true}, {"query": "choose between Cox and Fine-Gray for time to dialysis with death as a competing event, and justify it with literature - python lifelines stack", "should_trigger": true}, {"query": "Our outcome is ICU length of stay with lots of zeros and a long tail. Which regression family and link should we use, and what diagnostics and fallbacks should be prespecified?", "should_trigger": true}, {"query": "Help me justify the random-effects structure for a crossed design (patients x raters) on pain scores; glmmTMB is in renv.lock.", "should_trigger": true}, diff --git a/evals/methodsmith/skill-creator/method-omics-qc/evals.json b/evals/methodsmith/skill-creator/method-omics-qc/evals.json index 71d7a09e..c8ce7d7c 100644 --- a/evals/methodsmith/skill-creator/method-omics-qc/evals.json +++ b/evals/methodsmith/skill-creator/method-omics-qc/evals.json @@ -16,7 +16,8 @@ "design_identifiable is false in the requested structured advice, consistent with the explanation", "qc_pass is false in the requested structured advice, consistent with the explanation", "batch_deletion_establishes_validity is false in the requested structured advice, consistent with the explanation", - "rank_check_required_without_pc_separation is true in the requested structured advice, consistent with the explanation" + "rank_check_required_without_pc_separation is true in the requested structured advice, consistent with the explanation", + "The written explanation agrees with structured decisions and explains the applicable scientific rule." ] }, { diff --git a/evals/methodsmith/skill-creator/method-question/evals.json b/evals/methodsmith/skill-creator/method-question/evals.json index d3fb724e..04e334a5 100644 --- a/evals/methodsmith/skill-creator/method-question/evals.json +++ b/evals/methodsmith/skill-creator/method-question/evals.json @@ -3,7 +3,7 @@ "evals": [ { "id": 1, - "prompt": "Idea: does starting a GLP-1 receptor agonist reduce hip fracture risk in older adults with type 2 diabetes? We have Medicare claims 2016-2023 (Parts A/B/D). Harden this into something we can search and plan from. Also address this bounded scientific check as part of the assessment: Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation; every action need not finish in the first hour. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md.", + "prompt": "Idea: does starting a GLP-1 receptor agonist reduce hip fracture risk in older adults with type 2 diabetes? We have Medicare claims 2016-2023 (Parts A/B/D). Harden this into something we can search and plan from. Also address this bounded scientific check as part of the assessment: Use method-question to correct the exposure and outcome definitions for an adult sepsis cohort. The supplied official SCCM bundle defines fluids for hypotension or lactate >=4 mmol/L, vasopressors for hypotension during/after fluid resuscitation, and immediate initiation. We have confirmed 30-day vital status after discharge through a linked mortality source. Our draft calls anyone without all five actions completed in one hour nonadherent. Review a normotensive patient with low lactate who appropriately receives no vasopressors. Work offline using this supplied source excerpt; do not invent novelty evidence or query counts. Write workspace/advice.json with booleans unindicated_pressors_fail_adherence, requires_all_five_completed_one_hour, and string mortality_endpoint. Give the revised PICO/exposure rules and ascertainment in response.md.", "expected_output": "Fills PICO (with target-trial-emulation slots), scores FINER with rationales, suggests a design (target trial emulation/cohort), builds a recall-oriented PubMed query, suggests TARGET as the primary checklist with STROBE as companion and RECORD (RECORD-PE for claims pharmacoepidemiology) as extensions, writes analysis/research-question.yaml, and emits the __CE_RESEARCH_QUESTION__ signal. Also resolves the supplied scientific-contract scenario without inventing missing evidence.", "files": [], "expectations": [ @@ -16,7 +16,8 @@ "Does not run the PubMed search or write a SAP", "unindicated_pressors_fail_adherence is false in the requested structured advice, consistent with the explanation", "requires_all_five_completed_one_hour is false in the requested structured advice, consistent with the explanation", - "mortality_endpoint is \"30-day all-cause mortality\" in the requested structured advice, consistent with the explanation" + "mortality_endpoint is \"30-day all-cause mortality\" in the requested structured advice, consistent with the explanation", + "The written explanation agrees with structured decisions and explains the applicable scientific rule." ] }, { diff --git a/plugins/methodsmith/README.md b/plugins/methodsmith/README.md index 500068ee..ded94dad 100644 --- a/plugins/methodsmith/README.md +++ b/plugins/methodsmith/README.md @@ -415,7 +415,8 @@ restricted; only reviewed, disclosure-safe aggregate summaries enter Git. Printed-statistic checks preserve rounding and declared t/z sidedness; unsupported P-value constructions stay unchecked. Power anchors require source-reported SEs -or declared Wald interval methods, confidence levels and degrees of freedom. +or declared Wald interval methods and confidence levels, with degrees of freedom +required for t intervals only. Genome audits distinguish compatible header evidence from unknown or uninspected files. Prediction validation separates forward time from period transport, and omics identifiability is checked independently of PCA displays. Cohort eligibility diff --git a/plugins/methodsmith/skills/method-genome-build/SKILL.md b/plugins/methodsmith/skills/method-genome-build/SKILL.md index b5429de7..238fbb57 100644 --- a/plugins/methodsmith/skills/method-genome-build/SKILL.md +++ b/plugins/methodsmith/skills/method-genome-build/SKILL.md @@ -63,7 +63,7 @@ Write to `analysis/genome-build/manifest.yaml`. Commit this; it is the build-tru ### Step 2: Audit mode (--check) -Walk the project for build artifacts. When a build or naming is not declared in a header, infer it with `references/build-detection-rules.md` (contig lengths, naming, annotation file names). +Walk the project for build artifacts. Compare available provenance, diagnostic contig lengths and checksums with the manifest using `references/build-detection-rules.md`; naming supports consistency checks but cannot identify a build alone. | Artifact | Inspect | Expect | |----------|---------|--------| @@ -75,7 +75,7 @@ Walk the project for build artifacts. When a build or naming is not declared in | Counts matrix (RNA-seq) | rownames or `gene_id` column format | Match annotation gene_ids (e.g., ENSG00000... if Ensembl) | | Variant call output | `INFO/CSQ` annotation source if VEP | VEP cache version matches manifest | -For each file, determine its build (often inferable from contig naming + checksums). Flag mismatches: +For each file, record whether its build evidence is compatible, incompatible, unknown or uninspected. Flag mismatches: - **P0:** Different build between BAM and VCF (alignment in GRCh38, called against GRCh37 reference) - **P0:** Annotation version drift (Counts matrix uses GENCODE 36 but manifest says GENCODE 44) @@ -96,7 +96,7 @@ This table goes into the manuscript as a supplementary file -- it answers "what ### Step 4: Surface mismatches -If `--check` found any P0 → exit non-zero, print a clear report. The user resolves before proceeding. +If `--check` found any issue, exit non-zero and print a clear report. Resolve every issue before declaring the audit complete. ## What this skill does NOT do diff --git a/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py b/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py index d1dcccc5..cf67dcff 100644 --- a/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py +++ b/plugins/methodsmith/skills/method-genome-build/scripts/audit_build.py @@ -49,6 +49,7 @@ def have(cmd: str) -> bool: def inspect_bam(path: Path) -> dict: + """Read BAM/CRAM contig identity and build declarations through samtools.""" if not have("samtools"): return {"path": str(path), "error": "samtools not installed; cannot inspect"} try: @@ -62,16 +63,22 @@ def inspect_bam(path: Path) -> dict: if line.startswith("@SQ"): sn = m5 = ln = assembly = reference = None for tag in line.split("\t")[1:]: - if tag.startswith("SN:"): sn = tag[3:] - elif tag.startswith("M5:"): m5 = tag[3:] - elif tag.startswith("LN:"): ln = tag[3:] - elif tag.startswith("AS:"): assembly = tag[3:] - elif tag.startswith("UR:"): reference = tag[3:] + if tag.startswith("SN:"): + sn = tag[3:] + elif tag.startswith("M5:"): + m5 = tag[3:] + elif tag.startswith("LN:"): + ln = tag[3:] + elif tag.startswith("AS:"): + assembly = tag[3:] + elif tag.startswith("UR:"): + reference = tag[3:] contigs.append({"sn": sn, "m5": m5, "ln": ln, "assembly": assembly, "reference": reference}) return {"path": str(path), "kind": "bam", "contigs": contigs} def inspect_vcf(path: Path) -> dict: + """Read VCF header reference, assembly, contig length and MD5 evidence.""" opener = gzip.open if path.suffix == ".gz" else open contigs, ref = [], None try: @@ -96,6 +103,7 @@ def inspect_vcf(path: Path) -> dict: def inspect_gtf(path: Path) -> dict: + """Read GTF/GFF3 build metadata and the first feature's chromosome name.""" opener = gzip.open if path.suffix == ".gz" else open first_chrom = source = None try: @@ -120,6 +128,7 @@ def chr_style(name: str | None) -> str: def audit(root: Path, declared: str) -> tuple[list[dict], list[str]]: + """Classify files against a declared build using header evidence only.""" findings: list[dict] = [] issues: list[str] = [] if not root.is_dir(): @@ -200,6 +209,8 @@ def audit(root: Path, declared: str) -> tuple[list[dict], list[str]]: mismatches.append(f"chromosome 1 MD5 differs from declared build {declared}") else: evidence.append("matching chromosome 1 MD5") + mismatches = list(dict.fromkeys(mismatches)) + evidence = list(dict.fromkeys(evidence)) if mismatches: f["status"] = "incompatible" issues.extend(f"{f['path']}: {message}" for message in mismatches) @@ -240,7 +251,7 @@ def main() -> None: args.manifest.write_text(serialized) # Markdown report - md = [f"# Genome-build audit", "", + md = ["# Genome-build audit", "", f"Declared build: **{args.declared}**", f"Files inspected: {len(findings)}", "Scope: header declarations, diagnostic contig lengths and available MD5s; not complete sequence identity.", diff --git a/plugins/methodsmith/skills/method-meta-analysis/SKILL.md b/plugins/methodsmith/skills/method-meta-analysis/SKILL.md index a34931c8..fa1aae5c 100644 --- a/plugins/methodsmith/skills/method-meta-analysis/SKILL.md +++ b/plugins/methodsmith/skills/method-meta-analysis/SKILL.md @@ -52,7 +52,7 @@ Validate each row's uncertainty before selection: use a source-reported SE on th ### Step 2: Filter to comparable studies -Filter to the selected scientific target first; read the complete parsed contract in `references/effect-parser.md`. Resolve adjusted/marginal differences, units and overlapping cohorts before any fit. Save the selection code and excluded-study reasons. Write only the selected compatible rows to `analysis/effect-size/-selected.csv`; retain the full parsed CSV and exclusions for audit. Then filter: +Filter to the selected scientific target first; read the complete parsed contract in `references/effect-parser.md`. Resolve adjusted/marginal differences, units and overlapping cohorts before any fit. Exclude rows whose uncertainty remains unsupported, retaining their reasons. Save the selection code and excluded-study reasons. Write only the selected compatible rows with supported uncertainty to `analysis/effect-size/-selected.csv`; retain the full parsed CSV and exclusions for audit. Then filter: - `metric` matches `--metric` (or modal-metric if not specified); `scripts/pool_effects.R` matches the uppercase label exactly, so pass `HR`, not `hr` - No sample-size cutoff by default: inverse-variance weights already down-weight small studies. Pass `--min-n ` to `scripts/pool_effects.R` only as a sensitivity analysis, and then report the unfiltered estimate alongside it - Year within last `--years` window if passed @@ -62,7 +62,7 @@ Report N studies in the meta-analysis vs N in the input. ### Step 3: Pool -Run the bundled script on the selected CSV from Step 2 (the numerical columns plus the reviewed compatibility declarations in `references/effect-parser.md`; it fails on missing or incompatible declarations, so the raw methods table will not work). It applies the metric and CI filters (plus `--min-n` when passed), prints each dropped count, and writes the Markdown summary, a sibling `-forest.png`, the selected `-contract.csv`, and the Step 6 signal: +Run the bundled script on the selected CSV from Step 2 (the numerical columns plus the reviewed compatibility declarations in `references/effect-parser.md`; it fails on missing or incompatible declarations, so the raw methods table will not work). It applies metric and finite-point filters (plus `--min-n` when passed), prints each dropped count, and stops on any row without supported uncertainty. It writes the Markdown summary, a sibling `-forest.png`, the selected `-contract.csv`, and the Step 6 signal: ```bash SKILL_DIR=""; @@ -96,7 +96,7 @@ After pooling, compare the result with any published meta-analysis found under E # Pooled effect-size: for in Source: 14 studies extracted via `method-pubmed` and `method-extract` on -Filtered to: , complete CI, last 10 years -> 9 studies pooled +Filtered to: , validated uncertainty (reported SE or declared Wald CI), last 10 years -> 9 studies pooled ## Pooled estimate diff --git a/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md b/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md index 0fd1d1fa..196152e6 100644 --- a/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md +++ b/plugins/methodsmith/skills/method-meta-analysis/references/effect-parser.md @@ -56,7 +56,7 @@ Write `analysis/effect-size/-parsed.csv` with: - `population, comparator, estimand, outcome, time_horizon, adjustment_specification, adjusted, analysis_scale, unit, study_design, independent_unit_id`. -Every row needs `uncertainty_source` naming the read source/table. Prefer a source-reported `standard_error` with `standard_error_scale=log` for OR/HR/RR or `identity` for MD/SMD; never log a ratio-scale SE. Without a reported SE, require `ci_method` (`wald_normal` or `wald_t`), `ci_level` as a fraction (e.g., `0.95` or `0.90`), and `ci_df` for t intervals. Also declare `ci_rounding_tolerance`: the maximum midpoint discrepancy justified by the source's printed rounding on the analysis scale, not a free tolerance to make an asymmetric interval pass. Set zero for exact unrounded bounds. The bundled `scripts/effect_uncertainty.R`, called by the pooling helper, validates and reconstructs these SEs; its numerical extraction uses base R. +Every row needs `uncertainty_source` naming the read source/table. Prefer a source-reported `standard_error` with `standard_error_scale=log` for OR/HR/RR or `identity` for MD/SMD; never log a ratio-scale SE. Without a reported SE, require `ci_method` (`wald_normal` or `wald_t`), `ci_level` as a fraction (e.g., `0.95` or `0.90`), and `ci_df` for t intervals. Also declare `ci_rounding_tolerance`: the maximum midpoint discrepancy justified by the source's printed rounding on the fitted scale (log-transformed effect and bounds for OR/HR/RR; identity otherwise), not a free tolerance to make an asymmetric interval pass. Set zero for exact unrounded bounds. The bundled `scripts/effect_uncertainty.R`, called by the pooling helper, validates and reconstructs these SEs; its numerical extraction uses base R. Unknown, profile-likelihood, exact or bootstrap intervals cannot be converted by assuming a normal 95% CI. Obtain a justified source SE/variance or use an appropriate method outside this scalar helper; keep unresolved rows accounted for and block their use as a numeric power anchor. A valid source SE does not itself establish normality or scientific compatibility. @@ -126,6 +126,6 @@ Label every converted value as a conversion, with its inputs and their sources. ## Edge cases -- Asymmetric CI on the analysis scale beyond documented rounding: inspect its construction; never refit or symmetrize the published interval to manufacture a Wald SE. -- Known symmetric Wald CI: `SE = (upper - lower) / (2 * critical)` on the analysis scale, with `critical = qnorm((1+ci_level)/2)` or `qt((1+ci_level)/2, ci_df)`. Confidence level and degrees of freedom come from the source, not a default. See Cochrane Handbook chapter 6, section on obtaining SEs from confidence intervals: https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-06. +- Asymmetric CI on the fitted scale (log for OR/HR/RR; identity otherwise) beyond documented rounding: inspect its construction; never refit or symmetrize the published interval to manufacture a Wald SE. +- Known symmetric Wald CI: `SE = (upper - lower) / (2 * critical)` using log-transformed bounds for OR/HR/RR and identity-scale bounds otherwise, with `critical = qnorm((1+ci_level)/2)` or `qt((1+ci_level)/2, ci_df)`. Confidence level and, for t intervals only, degrees of freedom come from the source, not a default. See Cochrane Handbook chapter 6, section on obtaining SEs from confidence intervals: https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-06. - Multiple effect estimates per paper (primary + sensitivity): use the primary diff --git a/plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md b/plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md index eedb8f1f..14cdc2f0 100644 --- a/plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md +++ b/plugins/methodsmith/skills/method-model-choice/references/forward-temporal-validation.md @@ -2,7 +2,7 @@ Fix the intended validation target before selecting a splitter. -- Future deployment requires rolling or expanding calendar windows: train only on earlier observations and assess later periods. Fit preprocessing, tuning, and calibration within the same temporal boundaries. +- Assess future deployment on observations later than all model-development data, using either a frozen model with an independent later cohort or rolling/expanding calendar windows. Fit preprocessing, tuning, and calibration only within the applicable earlier development data. - Keep patients grouped across training and assessment. Apply a gap or purge when needed for overlapping prediction windows, delayed labels, or outcome maturation; for a 90-day outcome, confirm training labels would be available at the assessment origin. - `LeaveOneGroupOut` on calendar period uses every other period for training, including future periods. It can assess a justified historical period-transport target, but cannot establish forward performance. Label that target explicitly. - `TimeSeriesSplit` assumes ordered samples and equally spaced samples for comparable fold durations. Irregular clinical cohorts may require explicit calendar windows. Check its gap units and patient boundaries; a row-count gap does not automatically represent a clinical time interval. diff --git a/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py b/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py index 89884c39..af9f62fa 100644 --- a/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py +++ b/plugins/methodsmith/skills/method-verify/scripts/verify_stats.py @@ -157,12 +157,10 @@ def p_from_z(z): def printed_decimals(value): """Decimal places a value was printed with, from its string form.""" - if not isinstance(value, str) and float(value).is_integer(): - return 0 try: printed = Decimal(str(value).strip()) - except InvalidOperation: - raise InputError("value %r is not a number" % (value,)) + except InvalidOperation as error: + raise InputError("value %r is not a number" % (value,)) from error if not printed.is_finite(): raise InputError("value must be finite") return -printed.as_tuple().exponent @@ -177,8 +175,8 @@ def as_number(value): """Parse a printed value into a float, or raise InputError.""" try: number = float(str(value).strip()) - except (TypeError, ValueError): - raise InputError("value %r is not a number" % (value,)) + except (TypeError, ValueError) as error: + raise InputError("value %r is not a number" % (value,)) from error if not math.isfinite(number): raise InputError("value must be finite") return number diff --git a/scripts/evals/code-query.ts b/scripts/evals/code-query.ts index 74f4dfec..83107770 100644 --- a/scripts/evals/code-query.ts +++ b/scripts/evals/code-query.ts @@ -259,17 +259,24 @@ function partition(node: Node | undefined, loop: Node, bound: Bindings, depth = const { node: assignment, left, right } = write if (owner(assignment).id !== owner(node).id || assignment.endIndex >= node.startIndex || (assigned && assignment.startIndex <= assigned.startIndex)) continue - if (left.type === "identifier" && left.text !== node.text) { - if (right.type === "identifier" && aliases.has(right.text)) aliases.add(left.text) - else if (binding(left.text, node, false)?.id === right.id) { - let parent = assignment.parent - let conditional = false - while (parent && parent.id !== owner(node).id) { - if (["for_statement", "while_statement", "try_statement"].includes(parent.type) && - !(parent.startIndex <= node.startIndex && parent.endIndex >= node.endIndex)) conditional = true - parent = parent.parent + const pairs = ["pattern_list", "tuple_pattern", "tuple"].includes(left.type) && + ["expression_list", "tuple"].includes(right.type) + ? left.namedChildren.map((target, index) => ({ target, value: right.namedChildren[index] ?? right })) + : [{ target: left, value: right }] + const previousAliases = new Set(aliases) + for (const { target, value } of pairs) { + if (target.type === "identifier" && target.text !== node.text) { + if (value.type === "identifier" && previousAliases.has(value.text)) aliases.add(target.text) + else if (binding(target.text, node, false)?.id === value.id) { + let parent = assignment.parent + let conditional = false + while (parent && parent.id !== owner(node).id) { + if (["for_statement", "while_statement", "try_statement"].includes(parent.type) && + !(parent.startIndex <= node.startIndex && parent.endIndex >= node.endIndex)) conditional = true + parent = parent.parent + } + if (!conditional) aliases.delete(target.text) } - if (!conditional) aliases.delete(left.text) } } if (left.type === "subscript" && aliases.has(writtenRoot(left) ?? "")) writes.push(write) diff --git a/scripts/evals/lib.ts b/scripts/evals/lib.ts index 165b9271..a91bb505 100644 --- a/scripts/evals/lib.ts +++ b/scripts/evals/lib.ts @@ -814,7 +814,7 @@ function findAffirmativeClaim( "say|says|said|saying|conclud(?:e|es|ed|ing)|represent(?:s|ed|ing)?|" + "describ(?:e|es|ed|ing)|consider(?:s|ed|ing)?|call(?:s|ed|ing)?|" + "believ(?:e|es|ed|ing)|find|finds|found|finding|deem(?:s|ed|ing)?|" + - "treat(?:s|ed|ing)?)\\b(?:\\s+that)?\\s*$", + "treat(?:s|ed|ing)?|us(?:e[sd]?|ing)|establish(?:es|ed|ing)?|declar(?:e[sd]?|ing))\\b(?:\\s+that)?\\s*$", negationFlags, ) @@ -858,7 +858,8 @@ function findAffirmativeClaim( ) || qualifiedClaimFrame.test(predicateBeforeClaim) || temporalOrConditionalFrame.test(prefixBeforeSubject.trimStart()) || - negatedReportingFrame.test(prefixBeforeSubject) + (negatedReportingFrame.test(prefixBeforeSubject) && + hasOrdinaryNegation(prefixBeforeSubject, criterion.negation_pattern!, criterion.case_sensitive)) ) { continue } diff --git a/tests/behavioral-eval-contract.test.ts b/tests/behavioral-eval-contract.test.ts index a4c70790..2a8a0f03 100644 --- a/tests/behavioral-eval-contract.test.ts +++ b/tests/behavioral-eval-contract.test.ts @@ -245,6 +245,155 @@ for train, test in outer.split(frame): expect(report.pass).toBe(false) }) + test.each([ + "alias, other = y, 0", "(alias, other) = y, 0", + "alias, other = (y, 0)", "(alias, other) = (y, 0)", + "other, alias = 0, y", "(other, alias) = 0, y", + "other, alias = (0, y)", "(other, alias) = (0, y)", + ])("tracks pairwise tuple aliases from %s", async (assignment) => { + for (const rows of ["train", "test"]) { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + ${assignment} + alias.iloc[0] = frame.iloc[${rows}]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.criteria.find((criterion) => criterion.id === "nested-tuning")?.passed, rows).toBe(rows === "train") + expect(report.pass, rows).toBe(rows === "train") + } + }) + + test.each([ + 'alias, other = y, frame.iloc[test]["outcome"]', + '(alias, other) = (y, frame.iloc[test]["outcome"])', + ])("keeps unrelated tuple targets separate in %s", async (assignment) => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + ${assignment} + other.iloc[0] = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(true) + }) + + test.each([ + 'alias, other = frame.iloc[test]["outcome"], 0', + '(alias, other) = frame.iloc[test]["outcome"], 0', + 'alias, other = (frame.iloc[test]["outcome"], 0)', + '(other, alias) = (0, frame.iloc[test]["outcome"])', + ])("preserves tuple alias rebind semantics for %s", async (assignment) => { + for (const conditional of [false, true]) { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + alias, other = y, 0 + ${conditional ? `if condition:\n ${assignment}` : assignment} + alias.iloc[0] = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass, String(conditional)).toBe(!conditional) + } + }) + + test.each([ + 'for unused in items:\n alias, other = frame.iloc[test]["outcome"], 0', + 'while condition:\n alias, other = frame.iloc[test]["outcome"], 0', + 'try:\n alias, other = frame.iloc[test]["outcome"], 0\n except Exception:\n pass', + ])("retains tuple aliases across a potentially skipped rebind: %s", async (rebind) => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + alias, other = y, 0 + ${rebind} + alias.iloc[0] = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(false) + }) + + test.each([["alias", true], ["other", false]] as const)( + "uses pre-assignment aliases for simultaneous tuple rebinding before a %s write", + async (target, expected) => { + const report = await scoreCode(` +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X, y = frame.iloc[train][["feature"]], frame.iloc[train]["outcome"] + alias = y + other = frame.iloc[test]["outcome"] + alias, other = other, alias + ${target}.iloc[0] = frame.iloc[test]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(expected) + }, + ) + + test.each([ + "[]", "{}", "np.empty(len(train))", "np.zeros(len(train))", + "np.full(len(train), 0)", "np.full(len(train), 0.5)", + "np.full(len(train), True)", "np.full(len(train), False)", + "np.full(len(train), None)", "np.full(len(train), np.nan)", + "np.full(len(train), np.inf)", "np.full(len(train), fill_value=0)", + ])("tracks fresh label allocation %s through training and held-out writes", async (allocation) => { + for (const rows of ["train", "test"]) { + const report = await scoreCode(` +import numpy as np +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X = frame.iloc[train][["feature"]] + y = ${allocation} + y[0] = frame.iloc[${rows}]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.criteria.find((criterion) => criterion.id === "nested-tuning")?.passed, rows).toBe(rows === "train") + expect(report.pass, rows).toBe(rows === "train") + } + }) + + test.each([ + 'np.full(len(train), frame.iloc[test]["outcome"].iloc[0])', + 'np.full(len(train), fill_value=frame.iloc[test]["outcome"].iloc[0])', + ])("does not erase a nonliteral held-out allocation fill from %s", async (allocation) => { + const report = await scoreCode(` +import numpy as np +from sklearn.model_selection import GridSearchCV +for train, test in outer.split(frame): + X = frame.iloc[train][["feature"]] + y = ${allocation} + y[0] = frame.iloc[train]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, y) +`) + expect(report.pass).toBe(false) + }) + + test.each(["holder.labels[0]", "holder.labels.iloc[0]", "holder.labels.loc[0]"])( + "tracks the written root of %s through training and held-out writes", + async (target) => { + for (const rows of ["train", "test"]) { + const report = await scoreCode(` +from dataclasses import dataclass +from sklearn.model_selection import GridSearchCV +@dataclass +class Holder: + labels: object +for train, test in outer.split(frame): + X = frame.iloc[train][["feature"]] + holder = Holder(frame.iloc[train]["outcome"]) + ${target} = frame.iloc[${rows}]["outcome"].iloc[0] + selected = GridSearchCV(model, grid).fit(X, holder.labels) +`) + expect(report.criteria.find((criterion) => criterion.id === "nested-tuning")?.passed, rows).toBe(rows === "train") + expect(report.pass, rows).toBe(rows === "train") + } + }, + ) + test.each(["iloc[:]", "loc[:]", "iloc[0]", "loc[0]", "iloc[0:1]"])( "rejects held-out labels written through %s after a training-only tuple assignment", async (accessor) => { @@ -1484,6 +1633,66 @@ for train, test in splitter.split(X, y): } }) + test("AUPRC claim checks accept explicit refusals and reject primary declarations", async () => { + const original = await loadAndValidateCase(process.cwd(), path.join(process.cwd(), + "evals/methodsmith/cases/method-model-choice-ml-prediction/case.yaml")) + const ids = ["auprc-supplementary-only", "no-primary-auprc-declaration"] + const criteria = original.criteria.filter((item) => ids.includes(item.id)) + .map((item) => ({ ...item, path: "response.md" })) + const root = await makeRepo() + const casePath = await writeCase(root, sampleCase({ + criteria, required_behaviors: [ids[0]!], prohibited_behaviors: [ids[1]!], fixtures: [], threshold: 1, + })) + const definition = await loadAndValidateCase(root, casePath) + const runDir = await writeRun(root) + const examples: Array<[string, boolean]> = [ + ["AUPRC is the primary metric.", false], + ["Our primary metric is AUPRC.", false], + ["Primary metric: AUPRC", false], + ["We use average precision as the primary objective.", false], + ["Do not use AUPRC as the primary metric merely because outcomes are rare.", true], + ["Do not declare AUPRC the primary measure because prevalence is 6%.", true], + ["We are not using AUPRC as the primary metric.", true], + ["AUPRC is not the primary metric.", true], + ["Do not claim that AUPRC is the primary metric.", true], + ["This evidence does not establish AUPRC superiority as a primary objective.", true], + ["AUPRC is not primary but is the primary metric.", false], + ["Do not use an unvalidated score; AUPRC is primary.", false], + ["Do not use AUPRC as primary; the primary metric is AUPRC.", false], + ["The primary metric is not AUPRC.", true], + ["Log loss is primary. Average precision is supplementary.", true], + ["Do not only use AUPRC as primary.", false], + ] + for (const [text, expected] of examples) { + await writeFile(path.join(runDir, "response.md"), `${text}\n`) + const report = await scoreEvaluationRun({ repoRoot: root, casePath, definition, runDir }) + expect({ text, pass: report.pass }).toEqual({ text, pass: expected }) + } + }) + + test("sample-size evidence can span a detailed rationale without losing its required inputs", async () => { + const original = await loadAndValidateCase(process.cwd(), path.join(process.cwd(), + "evals/methodsmith/cases/method-model-choice-ml-prediction/case.yaml")) + const criterion = { ...original.criteria.find((item) => item.id === "sample-size-checked")!, path: "response.md" } + const root = await makeRepo() + const casePath = await writeCase(root, sampleCase({ + criteria: [criterion, sampleCase().criteria.find((item) => item.id === "no-secret")!], + required_behaviors: [criterion.id], prohibited_behaviors: ["no-secret"], fixtures: [], threshold: 1, + })) + const definition = await loadAndValidateCase(root, casePath) + const runDir = await writeRun(root) + for (const [text, expected] of [ + ["Use Riley criteria. " + "Count nonlinear terms and categorical contrasts before fitting. ".repeat(20) + "Declare the anticipated Nagelkerke R-squared and shrinkage target.", true], + ["Use Riley criteria with an anticipated R-squared and shrinkage target.", true], + ["Use Riley criteria.", false], + ["Report the shrinkage target without naming a sizing method.", false], + ] as const) { + await writeFile(path.join(runDir, "response.md"), `${text}\n`) + const report = await scoreEvaluationRun({ repoRoot: root, casePath, definition, runDir }) + expect({ text, pass: report.pass }).toEqual({ text, pass: expected }) + } + }) + test("trial-design claim_absent keeps subject ownership clause-local", async () => { const repoRoot = process.cwd() const casePath = path.join( diff --git a/tests/genome-build-audit.test.ts b/tests/genome-build-audit.test.ts index a52d60ba..d61c26db 100644 --- a/tests/genome-build-audit.test.ts +++ b/tests/genome-build-audit.test.ts @@ -42,6 +42,42 @@ test("matching declarations and lengths provide header evidence with an explicit expect(result.report).toContain("header") }) +test("repeated VCF and BAM build declarations yield unique evidence in first-seen order", () => { + const results = [ + audit({ "input.vcf": "##reference=GRCh38\n##contig=\n##contig=\n" }), + audit({ "input.bam": "synthetic BAM placeholder" }, "GRCh38", false, + "@SQ\tSN:1\tLN:248956422\tAS:GRCh38\tUR:GRCh38.fa\n@SQ\tSN:8\tLN:145138636\tAS:GRCh38\tUR:GRCh38.fa\n"), + ] + for (const result of results) { + expect(result.code).toBe(0) + expect(result.manifest.files[0].status).toBe("verified") + expect(result.manifest.files[0].evidence).toEqual([ + "matching build declaration", "matching chromosome 1 length", "matching chromosome 8 length", + ]) + expect(result.report).toContain("Issues found: **0**") + } +}) + +test("repeated build mismatches count once while distinct chromosome length issues remain", () => { + const results = [ + audit({ "input.vcf": "##reference=GRCh37\n##contig=\n##contig=\n" }), + audit({ "input.bam": "synthetic BAM placeholder" }, "GRCh38", false, + "@SQ\tSN:1\tLN:249250621\tAS:GRCh37\tUR:GRCh37.fa\n@SQ\tSN:8\tLN:146364022\tAS:GRCh37\tUR:GRCh37.fa\n"), + ] + for (const result of results) { + expect(result.code).toBe(2) + expect(result.manifest.files[0].status).toBe("incompatible") + expect(result.report).toContain("Issues found: **3**") + const issues = result.report.split("\n").filter((line: string) => line.startsWith("- ")) + .map((line: string) => line.slice(line.indexOf(": ") + 2)) + expect(issues).toEqual([ + "header declares GRCh37, expected GRCh38", + "chromosome 1 length 249250621 differs from GRCh38 length 248956422", + "chromosome 8 length 146364022 differs from GRCh38 length 145138636", + ]) + } +}) + test("absent build evidence and failed inspection never produce a clean audit", () => { const inputs: Record[] = [{ "input.vcf": "##contig=\n" }, { "input.bam": "synthetic placeholder" }] for (const files of inputs) { diff --git a/tests/scientific-advice-evals.test.ts b/tests/scientific-advice-evals.test.ts new file mode 100644 index 00000000..523b787f --- /dev/null +++ b/tests/scientific-advice-evals.test.ts @@ -0,0 +1,123 @@ +import { afterEach, expect, test } from "bun:test" +import { mkdtemp, mkdir, rm, writeFile } from "fs/promises" +import os from "os" +import path from "path" +import { loadAndValidateCase, scoreEvaluationRun, sha256File, sha256Target } from "../scripts/evals/lib" + +const roots: string[] = [] +afterEach(async () => { + await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true }))) +}) + +// These fixtures deliberately keep the sidecar correct while changing the advice. +const scenarios = [ + { + id: "method-meta-uncertainty-contract", + advice: { normal90_eligible: true, t9_eligible: true, unknown_eligible: false, profile_eligible: false, reported_log_se_eligible: true, invent_symmetric_interval: false, ratio_ci_se_scale: "log", normal_wald_requires_df: false }, + good: "Read the source table to confirm the confidence level and Wald construction. Use log-transformed ratio bounds; normal intervals require no df. Unknown and profile intervals without a source SE remain unresolved.", + bad: "unknown_eligible: true", + negated: "Do not claim unknown intervals are reconstructible.", + }, + { + id: "method-genome-build-evidence", + advice: { mismatch_status: "incompatible", no_evidence_status: "unknown", unavailable_tool_status: "uninspected", ready: false, naming_identifies_build: false, p1_blocks_clean_audit: true }, + good: "Header evidence contradicts the declared reference. Missing assembly evidence and unavailable tools are unresolved; naming alone does not establish sequence identity. P1 issues block a clean audit.", + bad: "ready: true", + negated: "Do not call an uninspected header verified.", + }, + { + id: "method-verify-test-contract", + advice: { incorrect_negative: "FAIL", noninferiority: "PASS", sequential: "WARN", unknown_sidedness: "WARN" }, + good: "The declared one-sided tail supports the non-inferiority result at alpha .025. Rounding cannot rescue the wrong negative statistic. Sequential adjustment and unknown direction remain unchecked.", + bad: "unknown_sidedness: PASS", + negated: "Do not verify an unknown tail or unsupported adjustment.", + }, + { + id: "method-cohort-baseline-observability", + advice: { eligible_at_index: true, requires_full_future_enrollment: false, review_informative_censoring: true }, + good: "Include the person at index. Censor follow-up at disenrollment on day 90; review informative censoring.", + bad: "Exclude the day-90 patient because the following year of enrollment is incomplete.", + negated: "Do not exclude the day-90 patient because future enrollment is incomplete.", + }, + { + id: "method-model-choice-forward-time", + advice: { uses_future_training: false, period_transport_is_forward_validation: false, review_outcome_maturation_gap: true, group_patient_encounters: true, single_later_cohort_valid: true }, + good: "Train on earlier calendar periods and assess later periods. Keep patients grouped and check the 90-day label-maturation gap. A frozen model may use one independent later cohort.", + bad: "We recommend a random split for future deployment.", + negated: "Do not use a random split for future deployment.", + }, + { + id: "method-omics-qc-hidden-aliasing", + advice: { design_identifiable: false, qc_pass: false, batch_deletion_establishes_validity: false, rank_check_required_without_pc_separation: true }, + good: "The condition contrast is not estimable because condition and batch are completely aliased. A rank check is required even without PC1/PC2 separation. Batch deletion does not establish publication validity.", + bad: "Batch deletion validates publication.", + negated: "Batch deletion does not validate publication.", + }, + { + id: "method-question-indicated-bundle", + advice: { unindicated_pressors_fail_adherence: false, requires_all_five_completed_one_hour: false, mortality_ascertainment_includes_post_discharge: true, mortality_endpoint: "30-day all-cause mortality" }, + good: "Population: adult sepsis. Exposure: initiate indicated bundle components at recognition; fluids for hypotension or lactate >=4, vasopressors for hypotension during or after fluids. Comparator: lower adherence to indicated components. Outcome: 30-day all-cause mortality. Ascertainment includes post-discharge linked vital status.", + bad: "All five actions must be completed within one hour for adherence.", + negated: "All five actions need not be completed within one hour for adherence.", + }, +] as const + +for (const scenario of scenarios) { + test(`${scenario.id} scores the explanation independently of a correct sidecar`, async () => { + const repoRoot = process.cwd() + const casePath = path.join(repoRoot, "evals/methodsmith/cases", scenario.id, "case.yaml") + const definition = await loadAndValidateCase(repoRoot, casePath) + const runDir = await mkdtemp(path.join(os.tmpdir(), "scientific-advice-")) + roots.push(runDir) + await mkdir(path.join(runDir, "workspace")) + await writeFile(path.join(runDir, "workspace/advice.json"), JSON.stringify(scenario.advice)) + await writeFile(path.join(runDir, "run.json"), JSON.stringify({ + schema_version: "1.0", case_id: definition.id, + case_sha256: await sha256File(casePath), + prompt_sha256: await sha256File(path.join(repoRoot, definition.prompt_path)), + target_sha256: await sha256Target(path.join(repoRoot, definition.target.source)), + runner: "deterministic-control", model: "none", + started_at: "2026-10-27T00:00:00Z", completed_at: "2026-10-27T00:01:00Z", + output_path: "workspace/advice.json", + })) + const rows = Object.entries(scenario.advice).map(([key, value]) => `${key}: ${value}`).join("\n") + const [firstKey, firstValue] = Object.entries(scenario.advice)[0]! + const wrongDecision = typeof firstValue === "boolean" ? !firstValue : `${firstValue}-inconsistent` + const score = () => scoreEvaluationRun({ repoRoot, casePath, definition, runDir }) + // Missing prose must fail closed, even if a runner selects JSON as its primary output. + try { + expect((await score()).pass).toBe(false) + } catch (error) { + expect(String(error)).toContain("missing") + } + for (const [text, expected] of [ + [`${rows}\n${scenario.good}`, true], + [`${rows}\n${scenario.good}\n${scenario.bad}`, false], + [`${rows}\n${scenario.good}\n${scenario.negated}`, true], + [rows, false], + [scenario.good, false], + [`${rows.replace(`${firstKey}: ${firstValue}`, `${firstKey}: ${wrongDecision}`)}\n${scenario.good}`, false], + ] as const) { + await writeFile(path.join(runDir, "response.md"), `${text}\n`) + const result = await score() + expect(result.pass).toBe(expected) + expect(result.hard_gates_passed).toBe(expected) + } + if (scenario.id === "method-question-indicated-bundle") { + for (const phrase of ["post-discharge", "after discharge", "after hospital discharge", "following discharge", "post-hospital-discharge"]) { + await writeFile(path.join(runDir, "response.md"), `${rows}\n${scenario.good.replace("post-discharge", phrase)}\n`) + expect((await score()).pass).toBe(true) + } + for (const [outcome, expected] of [ + ["**Outcome:** All-cause death within 30 days of recognition, including deaths after discharge.", true], + ["Outcome: all-cause mortality by day 30.", true], + ["Outcome: in-hospital mortality.", false], + ["Outcome: 90-day all-cause mortality.", false], + ] as const) { + const advice = scenario.good.replace("Outcome: 30-day all-cause mortality.", outcome) + await writeFile(path.join(runDir, "response.md"), `${rows}\n${advice}\n`) + expect((await score()).pass).toBe(expected) + } + } + }) +} diff --git a/tests/verify-stats.test.ts b/tests/verify-stats.test.ts index 76f14a4b..19baa80e 100644 --- a/tests/verify-stats.test.ts +++ b/tests/verify-stats.test.ts @@ -44,6 +44,7 @@ type Item = { reasons: string[] recomputed_p?: number envelope?: [number, number] + reported_interval?: [number, number] } type Report = { alpha: number @@ -63,6 +64,44 @@ function check(cwd: string, claims: string, out = "qc/stat_check.json"): { code: const claims = (items: unknown[]) => JSON.stringify({ alpha: 0.05, items }) describe("statistic recomputation gate", () => { + test("integral JSON statistic floats match printed strings without widening signed envelopes", () => { + // Interpolate raw JSON tokens: JSON.stringify would turn 2.0 into 2. + const items = ["2.0", "-2.0", "2", "-2"].flatMap((value) => [ + `{"statistic":"z","value":${value},"reported_p":"0.100"}`, + `{"statistic":"z","value":"${value}","reported_p":"0.100"}`, + ]) + const root = workspace({ "claims.json": `{"items":[${items.join(",")}]}` }) + const { code, report } = check(root, "claims.json") + expect(code).toBe(0) + expect(report.items.map((item) => item.verdict)).toEqual([ + "WARN", "WARN", "WARN", "WARN", "PASS", "PASS", "PASS", "PASS", + ]) + for (let i = 0; i < report.items.length; i += 2) { + expect(report.items[i]!.envelope).toEqual(report.items[i + 1]!.envelope) + } + expect(report.items[0]!.envelope).toEqual(report.items[2]!.envelope) + }) + + test("integral JSON reported P floats match printed strings without false PASS", () => { + const cases = [ + ["0.50", "1.0", "WARN"], ["-0.50", "1.0", "WARN"], + ["1.00", "0.0", "WARN"], ["-1.00", "0.0", "WARN"], + ["0.00", "1.0", "PASS"], ["10.00", "0.0", "PASS"], + ["0.50", "1", "PASS"], ["1.00", "0", "PASS"], + ] as const + const items = cases.flatMap(([value, reported]) => [ + `{"statistic":"z","value":"${value}","reported_p":${reported}}`, + `{"statistic":"z","value":"${value}","reported_p":"${reported}"}`, + ]) + const root = workspace({ "claims.json": `{"items":[${items.join(",")}]}` }) + const { code, report } = check(root, "claims.json") + expect(code).toBe(0) + expect(report.items.map((item) => item.verdict)).toEqual(cases.flatMap(([, , verdict]) => [verdict, verdict])) + for (let i = 0; i < report.items.length; i += 2) { + expect(report.items[i]!.reported_interval).toEqual(report.items[i + 1]!.reported_interval) + } + }) + test("scientific notation preserves the place value of the last printed digit", () => { const root = workspace({ "claims.json": claims(["2.00", "2.00e0", "20", "2.0e1", "20.0", "2.00e1"] .map((value) => ({ statistic: "z", value }))) })