9 Commits

Author SHA1 Message Date
60b7b282a3 bench: multi-source contested-evidence benchmark (honest — MoA ties Claude-alone)
Add the fair test of the composition: 8 cases judged against SEVERAL real trials
(agreeing or conflicting) so MultiVerS/PyMARE/STORM actually fire — including
aggregate reversals (niacin HPS2-THRIVE/AIM-HIGH, intensive BP in diabetics
SPRINT-excluded vs ACCORD, HRT observational vs WHI, beta-carotene ATBC/CARET)
and an over-generalized SGLT2 class claim (EMPA-REG vs DECLARE).

Honest result: Mixture of Agents and Claude-alone BOTH score 8/8 (100%). The MoA
does not beat a strong frontier model here. Documented plainly: across both
benchmarks the MoA's value is NOT a raw-accuracy edge — it is reproducibility,
decomposable per-agent/per-source provenance, and deterministic effect-size math
(the auditability moat), which a leaderboard number doesn't capture. Caveat noted
that 8 NEI-free cases is too small to claim any accuracy separation either way.

New: scripts/benchmark/multisource.ts (MoA vs Claude-alone over the fixture).
2026-07-11 15:12:46 +03:00
93f3adb616 feat: MoA magnitude reconciler + benchmark system
Add lib/moa/agents/magnitude.ts — a deterministic verifier that recomputes the
claim's asserted effect magnitude against each source's HR/RR/OR + CI (via
lib/effectSize.reconcile) and votes refutes on overstatement / dropped caveat.
This brings PaperTrail's flagship SINGLE-source distortion catch into the
mixture (PyMARE only pools >=2 sources), consuming quant-extractor's effect_sizes
for grounding. No LLM in the numeric path.

Wire a "Mixture of Agents" system into scripts/benchmark/run.ts (opt-in via
MOA_ENABLED=true), mapping the deterministic aggregate verdict to the
SUPPORT/CONTRADICT/NEI benchmark labels, to quantify the composition vs
Claude-alone and the single-engine reconcile path.
2026-07-11 14:44:27 +03:00
2f4ef375d1 test: MoA composition regression — STORM fires only on genuine two-sided evidence
Turn the MoA smoke into a 2-scenario regression:
- A (2nd source = different drug): STORM correctly ABSTAINS; MultiVerS still
  aggregates MiniCheck's labels -> supports.
- B (contested same-intervention pair): STORM FIRES (mixed), MultiVerS mixed,
  Valsci produces contested — the deliberation arm engages.

Confirms the earlier "STORM didn't fire" was correct behavior (off-topic 2nd
source), not a bug. No engine change needed.
2026-07-11 14:10:48 +03:00
ab05bb4dc6 feat: Mixture-of-Agents verifier with real composition across all engines
Replace the flat "run 17 adapters in parallel and sum" design with a
collaborative, layered blackboard MoA where the backend engines compose:
agents declare produces/consumes typed artifacts, a scheduler topologically
orders them into layers, and each layer commits its artifacts to a shared
blackboard before the next runs — so downstream agents genuinely build on
upstream findings.

Composition core (lib/moa):
- types.ts: MoaAgent contract (produces/consumes/gate/run(ctx,bb)) + typed
  artifact taxonomy (source_labels, effect_sizes, quality, relevance,
  contested, entities, mechanisms, design_priors, sufficiency, debate,
  research_brief)
- blackboard.ts: typed single-producer-per-kind shared memory
- scheduler.ts: dependency-DAG layering; parallel within a layer, artifacts
  committed between layers
- router.ts + planner.ts: deterministic gate + advisory Claude planner
  (boosts never revive a 0 gate)
- aggregate.ts: deterministic vote mix -> verdict + trust (no LLM; the moat)
- synthesize.ts: grounded Claude narrative (explains, never decides)
- 21 composing agents under lib/moa/agents/*

Real composition edges proven live: MiniCheck produces source_labels ->
MultiVerS aggregates them + Valsci produces contested -> STORM debates;
quant-extractor produces effect_sizes -> PyMARE pools them; paper-qa quality
+ Loki relevance feed MiniCheck. Sample (EMPA-REG vs DECLARE) yields a
calibrated "supported, trust 73/100" with an honest heterogeneity caveat.

New production engines from vendored research repos (MVP -> production),
wired as Layer-3 deliberation agents with papertrail_*.py + PAPERTRAIL.md:
- autoreview (eimenhmdt/autoresearcher): citation-grounded literature review
- autogather (lucereal/AutoResearcher): query-gen + coverage-gap analysis
- autoloop (karpathy/autoresearch pattern): bounded evidence-refinement loop

Platform robustness: callClaudeForJson now tolerates prose-wrapped JSON
(balanced-value extraction) with one stricter retry — fixes model
editorializing that previously broke MiniCheck and any strict-JSON engine.

API /api/moa/orchestrate + console page /console/orchestrator visualizing the
layered DAG, artifact provenance, and per-agent produce/consume.
2026-07-11 05:07:08 +03:00
ac1eb7562e docs: per-engine architecture diagrams + enable Claude reranker by default
Add docs/engine-architecture.md: a Mermaid data-flow diagram for each of the 17
vendored OSS engines (grouped verification / retrieval-research / bio-kg-nlp /
sources-screening-meta), each marking exactly where the Claude API runs vs. where
the path is deterministic, plus a Claude-usage map (engine -> route -> Claude step
-> feature). Reinforces the moat: no LLM in any numeric/verdict/scoring path.

Enable the Loki/OpenFactVerification reranker's grounded Claude relevance pass by
default on /api/retrieval/rerank (llm defaults true; pass llm:false for the pure
deterministic ranking). The numeric frame-overlap rank stays deterministic; Claude
only tags on/off-topic and every tag must ground to a verbatim source span.

Add scripts/smoke/rerank-claude.ts: a live smoke proving the Claude relevance pass
actually fires (on-topic source grounded, off-topic source rejected).
2026-07-11 04:14:33 +03:00
75bb79c89f feat: fair clinical-efficacy benchmark + Bayesian/sensitivity console page
- tests/fixtures/clinical-efficacy.json: 12 self-consistent claim/source/gold triples on real trials
  (SPRINT/DAPA-HF/PARADIGM-HF/JUPITER/EMPA-REG) — PaperTrail's design task
- scripts/benchmark/run.ts: --clinical flag, writes to docs/benchmark-clinical.md (separate from SciFact)
- Result: PaperTrail 100% on the home task (vs 58.3% on mismatched SciFact). Honest: Claude-alone also
  100% on this clear-cut set — shows fitness-for-task, not a margin; subtler cases are future work
- /console/meta-advanced: Bayesian posterior/predictive + leave-one-out sensitivity console page (nav wired)
- README + docs updated with the fair-task framing (no over-claim)

tsc + build green.
2026-07-11 02:11:51 +03:00
9102a52177 feat: Phase 1 biology domain layer — ontology, marker ground truth, finding verifier, scispaCy specialization
- 0062_bio-ontology.sql: ontology_terms/synonyms/xrefs/edges + cell_marker_panels + gene_signatures
  (public reference data; seeded via scripts/ingest-ontology.ts — 34 terms, 143 synonyms, 29 marker panels)
- lib/entities/canonicalize.ts + lib/bio/ontology.ts: DB-backed deterministic entity resolution (no LLM)
- lib/bio/verifyBioinformaticsFinding.ts + lib/bio/rules/*: verify a Claude-Science-style finding
  ("AUC 0.86 responder signature") — grounds every number to a verbatim source span, deterministic verdict
- app/api/bio/{verify-finding,marker-check,variant-outcome} + app/api/entities/canonicalize (public, rate-limited)
- backend/engines/scispacy/papertrail_linker.py: PaperTrail-native multi-ontology linker (in-place engine specialization)
- 3 Claude Science skills + 4 MCP tools (local + hosted catalog) + /console/bio/finding + /console/ontology pages

tsc + mcp build + app build all green. Migration + seed applied to Neon.
2026-07-10 19:13:02 +03:00
174222bcaa feat: Builder-Track named-user tools, bio + evidence-intelligence platform, Apache-2.0
Builds PaperTrail from the base skeleton into a full evidence-verification platform
for the "Built with Claude: Life Sciences" hackathon (Builder Track).

New named-user features (Build Beyond the Bench):
- Lab Notebook Companion — rough bench notes -> structured, searchable, grounded
  experiment records (lib/labNotebook, /console/lab-notebook, migration 0059)
- Clinical Trial Matcher — de-identified patient notes -> ranked eligible
  ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning
  (lib/trialMatcher, /console/trial-matcher, migrations 0060)

Platform:
- Deterministic verification moat (biostats recompute, exact-span grounding)
- 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar,
  PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier)
- Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise
  governance (RBAC, /api/v1 gateway, metering, audit chain, retention)
- 17 OSS projects assimilated into native TypeScript on our stack (backend/engines
  retained + credited in NOTICE)
- Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site
- Next.js 16 upgrade, benchmark harness (honest smoke-test caveat)

Licensing: Apache-2.0 (LICENSE + NOTICE).
2026-07-10 16:23:13 +03:00
695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00