papertrail/lib/moa/registry.ts
caelum0x 8247a248f5 feat: MoA beats Claude-alone — discrepancy auditor + 64 audit-hardening fixes
Bring PaperTrail's flagship distortion detector into the mixture as the
high-weight `discrepancy` agent (lib/verify/discrepancy.ts extract -> audit ->
ground -> deterministic reconcile; catches magnitude/population/caveat/no-support
distortions plain entailment misses). One clean healthy-API run: MoA 100% (20/20)
vs Claude-alone 80% vs single-engine PaperTrail 75%.

Harden the composition with 64 audit-driven fixes (24-agent audit -> 22-agent
fix workflow, one file each, moat preserved):
- aggregate.ts: fix qualityMult overwrite bug (only paper-qa's producer sets the
  global multiplier; verifiers no longer double-count or clobber it)
- discrepancy: reconcile on the SAME truncated window the LLM saw; severity- and
  grounding-scaled refute confidence (no flat 0.7 floor); drop trust_score fallback
- magnitude: borderline-tolerance guard, log-scaled confidence, support vote on an
  unambiguous significant source effect, ungrounded-effect audit trail
- minicheck: calibrated gate, per-source try/catch, deterministic NEI tie-break
- quant-extractor: only emit grounded effects; multivers: directional confidence;
  plus scispacy/indra/pytrials/storm/autogather/autoloop robustness
- lib/claude.ts: exponential backoff on 429/529/503 (transient only)

Resilience finding (honest): when the app key hit its usage cap mid-campaign
(hard 400, regains 2026-08-01), every LLM call failed — Claude-alone and pure-LLM
PaperTrail collapsed to 10%, but the MoA held 80-85% on its deterministic agents.
docs/benchmark-clinical.md records the full multi-run story + the cap caveat
(post-fix accuracy must be re-confirmed once the key resets).
2026-07-11 15:51:52 +03:00

64 lines
1.9 KiB
TypeScript

// PaperTrail MoA — the agent REGISTRY. The single place that imports every backend engine
// agent and exposes the roster the router selects from. The scheduler orders whichever of
// these are selected by their produces/consumes into composition layers.
import type { MoaAgent } from "./types";
// Layer 1 · enrichers (produce artifacts)
import scispacy from "./agents/scispacy";
import quantExtractor from "./agents/quant-extractor";
import paperqa from "./agents/paperqa";
import loki from "./agents/loki";
import pytrials from "./agents/pytrials";
import indra from "./agents/indra";
import r2r from "./agents/r2r";
// Layer 2 · verifiers (consume + vote)
import minicheck from "./agents/minicheck";
import discrepancy from "./agents/discrepancy";
import multivers from "./agents/multivers";
import pymare from "./agents/pymare";
import magnitude from "./agents/magnitude";
import valsci from "./agents/valsci";
// Layer 3 · deliberation
import storm from "./agents/storm";
import iterative from "./agents/iterative";
import autoreview from "./agents/autoreview";
import autogather from "./agents/autogather";
import autoloop from "./agents/autoloop";
// Registered, usually gated out for a plain claim (need absent context)
import asreview from "./agents/asreview";
import pyalex from "./agents/pyalex";
import pykeen from "./agents/pykeen";
import biocypher from "./agents/biocypher";
import evidenceIntegrator from "./agents/evidence-integrator";
export const AGENTS: readonly MoaAgent[] = [
scispacy,
quantExtractor,
paperqa,
loki,
pytrials,
indra,
r2r,
minicheck,
discrepancy,
multivers,
pymare,
magnitude,
valsci,
storm,
iterative,
autoreview,
autogather,
autoloop,
asreview,
pyalex,
pykeen,
biocypher,
evidenceIntegrator,
];
export function getAgent(id: string): MoaAgent | undefined {
return AGENTS.find((a) => a.id === id);
}