Skip to content

fix(skills): correct verify, genome-build and pubmed guidance; guard sprint signoff and review scope - #82

Merged
sajor2000 merged 13 commits into
mainfrom
stats-stack/15-verify-pubmed-sprint
Oct 16, 2026
Merged

sajor2000 merged 13 commits into
mainfrom
stats-stack/15-verify-pubmed-sprint

Conversation

@sajor2000

Copy link
Copy Markdown
Owner

Stack 16 of 17 (statistical-correctness audit). Base: stats-stack/14-descriptions. Review and merge bottom-up, starting with #66.

36 files changed, 320 insertions(+), 123 deletions(-)

Commits

  • 6024fee8 fix(verify): judge missing data by mechanism and tighten leakage and reproducibility checks
  • 824a6d9a fix(genome-build): correct GENCODE 44 example and build-detection rules
  • ec2013ba fix(pubmed): keep unindexed and non-English records by default
  • 4082c3c5 fix(clinical-research-voice): reserve significant for prespecified tests
  • 2ba8a483 fix(skills): move evidence-access boilerplate into per-skill references
  • 8cee04a7 fix(optimize): flag selection-biased CV scores and widen the leakage guard
  • bce702e2 fix(sprint): add a guarded signoff subcommand and fix SAP example refs
  • 4f9420b9 fix(code-review): fail closed when the private scope dir is unset
  • fa0f6223 fix(skills): trim rationale prose and time-sensitive wording
  • 767eebf1 fix(effect-size): name REML/Hartung-Knapp pooling and pool trigger in description
  • e1161ec5 fix(skills): keep edited SKILL.md files under the 16 KB budget

Changes and sources

Each source was read at the primary text before citing (NCBI E-utilities, Paperclip full text, Browserbase fetch, regulatory PDFs).

  • Claim rows require all five ICH E9(R1) attributes, with a strategy for each intercurrent event. New guardrail: hypothetical and principal-stratum strategies are flagged as untestable and need a sensitivity analysis. Sources: ICH E9(R1) Step 4, A.3.2-A.3.3 (adopted 20 Nov 2019); Kahan et al., BMJ 2024;384:e076316, PMID 38262663.
  • New references/estimands.md covers the attributes, the strategies, why analysis sets are not estimands, sensitivity versus supplementary analyses (E9(R1) A.5.2-A.5.3; Morris, Kahan & White, BMC Med Res Methodol 2014, PMID 24456267), and missing data defined relative to the estimand (A.5.2.2). It also covers conditional versus marginal summaries, the target-trial protocol, and a worked Claim/Analysis/Decision_Evidence example. Conditional/marginal sources: FDA Adjusting for Covariates in RCTs, May 2023 (prespecify before unblinding, include strata variables, no post-randomization covariates, conditional vs unconditional, bootstrap SEs); CONSORT 2025 item 25.
  • Target-trial protocol: all seven components, time zero at eligibility plus assignment in every arm, grace period with clone-censor-weight, per-protocol effects via artificial censoring plus IPW, and TARGET reporting. Sources: Hernán & Robins, AJE 2016, PMID 26994063; Hernán & Robins, NEJM 2017, PMID 28976864; TARGET JAMA 2025, PMID 40899949, and BMJ 2025, PMID 40903028.
  • Minimum content for the missing-data strategy: mechanism, when complete-case is valid, the MI model, m ≥ % incomplete, Rubin's rules, and an MNAR delta/tipping-point analysis (White, Royston & Wood, Stat Med 2011, PMID 21225900).
  • For trial SAPs, a completeness check against Gamble et al., JAMA 2017;318:2337-43, PMID 29260229 (55 items).
  • Title changed to "Claim-Linked", with a note that this skill is unrelated to insurance claims. The generic evidence-access block moved to references/evidence-access.md, identical to PR fix(stats): correct power, effect-size and trial-design methods #66 and using fully qualified MCP names. README row updated.
  • Adds SAP-1.4 Estimand(s). SAP-4 is reframed as analysis sets, and SAP-4.2 now says whether each analysis is a sensitivity or a supplementary analysis.
  • SAP-9 separates sensitivity analyses (same estimand) from supplementary ones (E9(R1) A.5.2-A.5.3; Morris 2014). Existing IDs are not renumbered.
  • SAP-5.1 now requires conditional vs marginal, the confidence level and sidedness, and stratification factors (FDA 2023).
  • New RCT sections:
    • SAP-5.4 interim analyses and stopping
    • SAP-5.5 protocol deviations and adherence, mapped to SAP-1.4
    • SAP-5.6 harms and software
  • Writing Guidance adds a Gamble 2017 cross-check and SPIRIT 2025 (34 items; BMJ 2025;389:e081477, PMID 40294953).
  • SAP-6 sample size: Riley criteria for prediction models (BMJ 2020;368:m441, PMID 32188600; CRAN pmsampsize), CI width for precision studies, and no post-hoc power (Hoenig & Heisey, Am Stat 2001;55:19-24, doi:10.1198/000313001300339897).
  • Adds early-clinical-ai-evaluation and protocol_stage to the frontmatter.
  • Gap checklist: new critical "no estimand" item, sample size by design, sensitivity vs supplementary, and an RCT minimum-content item. sap-mode-workflow.md and SKILL.md now treat an unresolved estimand as a blocker.
  • New eval case ce-plan-rct-estimand-sap.
  • Adds probes for time zero / target trial and for estimand / intercurrent events (Hernán & Robins 2016).
  • bun run eval:validate: all cases valid, including the new ce-plan-rct-estimand-sap.
    Implements the approved "fix all" audit for the reporting/omics scope (reporting-omics.md), plus three items from recent-changes.md: phenotype verification bias, GEE MCAR vs mixed-model MAR, and the ecology-heavy mixed-model reading list. Branch: fix/stats-reporting-omics. No version bumps or CHANGELOG entries.
  • Each file uses mcp__pubmed-mcp-server__… and mcp__paperclip__… names, and loads the ce-pubmed skill instead of reaching into its script.
    Branch: fix/stats-skill-craft. Implements the skill-craft audit (skill-craft.md, except A1, A2, A10, A11, A17), the Skill-craft description findings from all six reports, and two items from recent-changes.md (PHI scope guard, flaky test timeouts). No version bumps or CHANGELOG release entries; the one CHANGELOG edit is the requested 3.3.0 header link.
  • Overlap deconfliction (skill-craft.md Part C):
    • C2: ce-scientific-writing is the drafting entry point; ce-clinical-research-voice, ce-scientific-anti-slop, and ce-manuscript-section-discipline name themselves as passes and hand drafting off.
    • C3: ce-brainstorm drops "refine a research question"; ce-research-question owns PICO/FINER for a chosen question; ce-ideate hands one idea to ce-brainstorm.
    • C4: ce-adversarial-review fires only on an explicit adversarial or cross-model request; ce-rstats sends diffs and PRs to ce-code-review.
    • C5-C9: ce-workflow ("what to run next"), ce-setup (configure plugin), ce-sprint (open/close/check), ce-review-pack owns "signoff", ce-pubmed is explicit-PubMed only, ce-optimize sends broken runs to ce-debug, and ce-verify leads with "analysis-output sanity gate".
    • C1: the 15 skills that share names with compound-engineering state their data-science scope. The README gains a "Coexisting with compound-engineering" note. It points to namespaced /ce-datascience:ce-plan and /plugin, because skillOverrides does not apply to plugin skills (docs: "Plugin skills are not affected by skillOverrides").
  • Per-report items: ce-statistical-analysis-plan says "scientific claims, not insurance claims"; ce-sap-drift-detector says it returns JSON; ce-calibration-reviewer uses the D6 text; ce-reporting-checklist-reviewer drops the stale "35 guidelines" count; ce-figure drops the environment list; ce-effect-size names REML + Hartung-Knapp pooling and "pool"/"meta-analysis" triggers (handoff from PR fix(stats): correct power, effect-size and trial-design methods #66).
  • One trigger eval query reworded (ce-brainstorm) to match C3.
  • The missing-data gate no longer passes or fails on percent missing. It checks:
    • the stated mechanism and SAP handling;
    • that the outcome is in the imputation model;
    • that m >= the percentage of incomplete cases.
    • Sources: Madley-Dowd et al., J Clin Epidemiol 2019;110:63-73, PMID 30878639 (PMC6547017 read); White, Royston & Wood, Stat Med 2011;30:377-99, PMID 21225900 (rule confirmed via van Buuren, FIMD 2nd ed. §2.8).
  • Data paths must be project-relative or config-driven, not absolute (A4: the old text was backwards).
  • Leakage list adds:
    • feature selection or SMOTE before the split;
    • test-set threshold tuning;
    • duplicate encounters across splits;
    • post-index predictors.
    • Source: Kapoor & Narayanan, Patterns 2023;4:100804, PMID 37720327.
  • Effect direction: check the reference level and event coding before warning; a CI spanning the null is not a reversal.
  • The figure check follows the ce-figure style profile instead of JAMA by default. Seeds: NumPy default_rng (NumPy docs recommend Generator over legacy RandomState) and parallel R RNG.
  • The example report and the skill-creator eval expectations were updated to match.
  • The example now pairs GENCODE 44 with its own chr-named primary-assembly FASTA (alt_count 0), the Ensembl 110 equivalent, with 62,700 genes and 252,835 transcripts.
    • I chose GENCODE's FASTA over the audit's Ensembl FASTA because the audit's version would itself mix bare and chr naming against a GENCODE GTF.
    • Sources: GENCODE FAQ ("release 110 (equivalent to GENCODE release 44)"), GENCODE 44 stats page, GENCODE release_44 page (GRCh38.p14), and the FASTA URL (HTTP 200).
  • hg19 chrM is 16,571 and b37 MT is 16,569 (sources: UCSC hg19/hg38 chrom.sizes; Ensembl GRCh37 REST /info/assembly/homo_sapiens/MT length 16569).
  • Build is inferred from the filename assembly token, not the release number (Homo_sapiens.GRCh37.87.gtf.gz returns HTTP 200 on the Ensembl GRCh37 archive); vNNlift37 is GRCh37; "v20+ without lift37" replaces the time-sensitive v44-46 list.
  • GDC used GENCODE v22 through DR31 and v36 from DR32 (source: GDC GENCODE update FAQ).
  • Detection rules are now loaded on demand instead of @-inlined.
  • The human limit is now NOT (animals[mh] NOT humans[mh]), verified against Cochrane Handbook ch. 4, Box 4.4.a.
    • The old humans[MeSH] filter dropped unindexed records. Live check, "sepsis bundle" over the last 10 years: 1,073 vs 776 hits.
  • English[lang] is now opt-in (--english-only), per Cochrane Handbook §4.4: "searches should not be restricted by language".
  • New --study-type rct-sensitive (Cochrane HSSS, Box 4.4.a feat: ce-datascience 40-skill release with workflow navigator and competitive ports #1-fix(integrations): harden installs and MCP project roots #8).
  • prediction and diagnostic filters are labeled high-precision discovery aids, with Geersing 2012 (PLoS One, PMID 22393453) named for reviews.
  • Biopython via uv run --with biopython or the project environment.
  • Removed the journal-prestige ranking and the rationale prose.
  • New stub test checks the query string.
  • "significant" requires a prespecified test with its estimate and CI; "substantial" requires an effect size; "robust" requires named sensitivity analyses. A contradicting nearby statistic no longer passes.
    • Source: Wasserstein & Lazar, Am Stat 2016;70:129-33, doi:10.1080/00031305.2016.1154108 (Crossref-verified), principles 3 and 5.
  • The example uses P<.001 and defers to the target journal's convention. I did not attribute this rule to JAMA: jamanetwork.com blocked curl, tavily, Browserbase, and the PDF, and browser-harness needs remote debugging enabled.
  • The best CV score after many iterations is flagged as selection-biased. The skill now reports the held-out test score and uses nested CV or a fresh split when the test set is small.
    • Source: Cawley & Talbot, JMLR 2010;11:2079-2107 (jmlr.org/papers/v11/cawley10a).
  • The leakage guard is widened (Kapoor & Narayanan 2023).
  • The worktree cap of 12 and the 10-30 hypothesis count are labeled as defaults. There is no execution.max_worktrees key in the spec schema, so none was invented.
  • New subcommand sprint.py signoff NAME --by REVIEWER. It refuses unless the sprint is closed_pending_signoff and the signer is the named reviewer, which replaces the hand-edited YAML step. A test covers it.
  • The example scope moves to SAP-5.1/5.2 (analysis sections); sap_version is now the integer 2.
  • Every scope snippet that writes under $REVIEW_SCOPE_DIR starts with : "${REVIEW_SCOPE_DIR:?...}". A fresh shell call now stops instead of writing PR metadata to /paths or /pr-preflight.json. A structure test enforces this.
  • For ce-grill, ce-literature-search, ce-manuscript-citations, and ce-pubmed, the generic bullets moved to a skill-local references/evidence-access.md. SKILL.md keeps a pointer plus "Look up here".
  • In all owned copies (including ce-plan, ce-ideate, ce-brainstorm, ce-code-review references, and ce-literature-search mcp-routing.md):
    • the PubMed prefix is now mcp__pubmed-mcp-server__pubmed_search_articles (confirmed against this session's connected server);
    • Paperclip gets a qualified example;
    • the fallback "load the ce-pubmed skill" replaces reaching into its script.
  • ce-plan: when SAP keywords appear in a code-change request, the skill asks which mode to use.
  • ce-update: design-history rationale dropped.
  • ce-worktree: the time-sensitive claim was dropped.

Rejected or changed after checking

  • C0 "add disable-model-invocation to ce-clean-gone-branches, ce-handoff, ce-sprint": not applied.
    • ce-release-notes, ce-report-bug, and ce-update already have it.
    • Adding it to the others would stop natural-language requests ("clean up gone branches", "write a handoff") from routing, and ce-sprint is loaded by 9 other files.
    • The listing-budget goal is met by trimming instead.

Validation

Run at this exact stack position: bun test --timeout 60000, bun run release:validate, bun run eval:validate all pass (see stack summary on #66). Live skill-creator behavioral runs were not performed.

…reproducibility checks

- Missing-data gate no longer passes/fails on percent missing; checks mechanism,
  SAP handling, outcome in the imputation model, and m >= % incomplete cases
  (Madley-Dowd 2019 PMID 30878639; White, Royston & Wood 2011 PMID 21225900)
- Reproducibility: data paths must be project-relative or config-driven, not
  absolute; NumPy default_rng and parallel R RNG seeds
- Leakage: feature selection/SMOTE before split, test-set tuning, duplicate
  encounters, post-index predictors (Kapoor & Narayanan 2023 PMID 37720327)
- Effect direction: check reference level and event coding before warning
- Figure check follows the ce-figure style profile, not JAMA by default
- Example pairs GENCODE 44 with its own chr-named FASTA (Ensembl 110
  equivalent), counts 62,700 genes / 252,835 transcripts (GENCODE stats)
- hg19 chrM 16,571 vs b37 MT 16,569 (UCSC chrom.sizes; Ensembl GRCh37 REST)
- Build from filename assembly token, not Ensembl release number; vNNlift37
- GDC GENCODE v22 through DR31, v36 from DR32 (GDC GENCODE update FAQ)
- Load detection rules on demand instead of @-inlining
- Human limit uses the Cochrane double negative NOT (animals[mh] NOT humans[mh])
  instead of humans[MeSH], which dropped in-process records (Cochrane Handbook
  ch. 4 Box 4.4.a); same query returned 1,073 vs 776 hits
- English[lang] is opt-in via --english-only (Cochrane Handbook 4.4)
- Add rct-sensitive (Cochrane HSSS) and label prediction/diagnostic filters as
  high-precision discovery aids (Geersing 2012, PMID 22393453)
- Biopython via uv run or the project environment, not a shared interpreter
- Drop journal-prestige ranking and rationale prose
- 'significant' needs a prespecified test with estimate and CI, 'substantial'
  an effect size, 'robust' named sensitivity analyses (ASA statement 2016,
  principles 3 and 5); a contradicting nearby statistic no longer passes
- Example P value follows the target journal's convention instead of P<0.0001
Move the generic PubMed/Paperclip bullets for ce-grill, ce-literature-search,
ce-manuscript-citations, and ce-pubmed into each skill's own
references/evidence-access.md, keeping only the skill-specific lookup in
SKILL.md. Use the real default-server prefix
(mcp__pubmed-mcp-server__pubmed_search_articles) and hand off to the ce-pubmed
skill instead of reaching into its bundled script.
…guard

Best CV/validation score after many iterations is optimistic (Cawley & Talbot,
JMLR 2010); report the held-out test score, use nested CV when the test set is
small. Leakage guard adds feature selection/SMOTE, test-set thresholds,
patient-level grouping, and prediction-time availability (Kapoor & Narayanan
2023, PMID 37720327). Label the worktree cap and hypothesis count as defaults.
sprint.py signoff NAME --by REVIEWER replaces the hand-edited YAML step; it
refuses unless the audit passed and the signer is the named reviewer. The
example now scopes analyses to SAP-5.x and uses an integer sap_version, as
ce-plan defines them.
Each scope snippet that writes PR metadata or path lists under
$REVIEW_SCOPE_DIR now starts with a :? guard, so a fresh shell call stops
instead of writing to /paths or /pr-preflight.json. The PHI-safe preflight
is a numbered checklist (classify, capture privately, risk check,
authorization marker). Adds a structure test for the guard.
- ce-plan: confirm the mode when SAP keywords appear in a code-change request
- ce-update: keep the two operative rules, drop design-history rationale
- ce-worktree: drop the 'most harnesses now' time-sensitive claim
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This review is too large to run within your organization's remaining usage spending cap. Raise or remove your spending cap in the billing tab, then retry.

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 57 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: cc548800-359a-48d9-afe9-a606ef505ac5
📥 Commits

Reviewing files that changed from the base of the PR and between e10c0c3 and 49720ef.

📒 Files selected for processing: 36
  • evals/ce-datascience/skill-creator/ce-genome-build/evals.json
  • evals/ce-datascience/skill-creator/ce-verify/evals.json
  • plugins/ce-datascience/skills/ce-brainstorm/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-clinical-research-voice/SKILL.md
  • plugins/ce-datascience/skills/ce-code-review/SKILL.md
  • plugins/ce-datascience/skills/ce-code-review/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-code-review/references/intent-and-plan.md
  • plugins/ce-datascience/skills/ce-code-review/references/scope.md
  • plugins/ce-datascience/skills/ce-effect-size/SKILL.md
  • plugins/ce-datascience/skills/ce-genome-build/SKILL.md
  • plugins/ce-datascience/skills/ce-genome-build/references/build-detection-rules.md
  • plugins/ce-datascience/skills/ce-grill/SKILL.md
  • plugins/ce-datascience/skills/ce-grill/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-ideate/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-literature-search/SKILL.md
  • plugins/ce-datascience/skills/ce-literature-search/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-literature-search/references/mcp-routing.md
  • plugins/ce-datascience/skills/ce-manuscript-citations/SKILL.md
  • plugins/ce-datascience/skills/ce-manuscript-citations/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-optimize/SKILL.md
  • plugins/ce-datascience/skills/ce-plan/SKILL.md
  • plugins/ce-datascience/skills/ce-plan/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-pubmed/SKILL.md
  • plugins/ce-datascience/skills/ce-pubmed/references/evidence-access.md
  • plugins/ce-datascience/skills/ce-pubmed/references/mesh-expansion.md
  • plugins/ce-datascience/skills/ce-pubmed/scripts/pubmed_search.py
  • plugins/ce-datascience/skills/ce-scientific-anti-slop/SKILL.md
  • plugins/ce-datascience/skills/ce-sprint/SKILL.md
  • plugins/ce-datascience/skills/ce-sprint/scripts/sprint.py
  • plugins/ce-datascience/skills/ce-update/SKILL.md
  • plugins/ce-datascience/skills/ce-verify/SKILL.md
  • plugins/ce-datascience/skills/ce-verify/references/check-catalog.md
  • plugins/ce-datascience/skills/ce-worktree/SKILL.md
  • tests/ce-code-review-structure.test.ts
  • tests/pubmed-search-max.test.ts
  • tests/sprint-signoff.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@sajor2000
sajor2000 changed the base branch from stats-stack/14-descriptions to main October 16, 2026 02:41
@sajor2000
sajor2000 merged commit 83ccd07 into main Oct 16, 2026
5 checks passed
@sajor2000
sajor2000 deleted the stats-stack/15-verify-pubmed-sprint branch October 16, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant