caelum0x 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

60 lines
2.7 KiB
Python

from .utils.views import print_agent_output
from .utils.llms import call_model
class FactCheckerAgent:
def __init__(self, websocket=None, stream_output=None, headers=None):
self.websocket = websocket
self.stream_output = stream_output
self.headers = headers or {}
async def check_facts(self, research_state: dict):
task = research_state.get("task")
# Assemble a draft representation for the fact checker
intro = research_state.get("introduction", "")
conclusion = research_state.get("conclusion", "")
data = research_state.get("research_data", [])
draft = f"Introduction:\n{intro}\n\nSections Data:\n{data}\n\nConclusion:\n{conclusion}"
prompt = [
{
"role": "system",
"content": "You are a diligent Fact Checker Agent. Your goal is to review a research report draft, identify potential factual inaccuracies, hallucinations, or inconsistencies based on the provided research context, and decide if it needs to be sent back to the writer for revision.",
},
{
"role": "user",
"content": f"Review the following draft for factual accuracy:\n\n{draft}\n\nIf you find critical errors, provide a list of them so the writer can revise the draft. If the draft is factually sound, return exactly the string 'None'. Do not return any other text if it is accepted."
}
]
response = await call_model(prompt, model=task.get("model"))
return response
async def run(self, research_state: dict):
if self.websocket and self.stream_output:
await self.stream_output(
"logs",
"fact_checking",
f"Checking facts in the assembled draft...",
self.websocket,
)
else:
print_agent_output(f"Checking facts in the assembled draft...", agent="FACT_CHECKER")
review = await self.check_facts(research_state)
if "None" in review:
review = None
if self.websocket and self.stream_output:
await self.stream_output("logs", "fact_checking", "Draft accepted by Fact Checker.", self.websocket)
else:
print_agent_output("Draft accepted by Fact Checker.", agent="FACT_CHECKER")
else:
if self.websocket and self.stream_output:
await self.stream_output("logs", "fact_checking", f"Fact Checker found issues: {review}...", self.websocket)
else:
print_agent_output(f"Fact Checker found issues: {review}...", agent="FACT_CHECKER")
return {"fact_check_notes": review}