ask-oe-with-ego
Ask OpenEvidence with ego-browser
Two layers, deliberately split:
- Capture — needs ego (
scripts/dump.mjs). Reuses the user's real, DataDome-trusted OpenEvidence session to ask/publish and snapshot the rendered SPA DOM intooe-<id>.dump.json. This is the only step that touches openevidence.com. A headless Playwright/Puppeteer would trip DataDome here (webdriver + fingerprint + datacenter IP + no clearance cookie) — ego works because it is the user's trusted browser. - Transform — fully standalone (
scripts/oe-transform.mjs). Plain Node (≥18, globalfetch), no ego, no browser. Reads a dump, resolves every reference through the Crossref API (PMIDs converted via NCBI first), and writesoe-<id>.html+.bib+.csl.json+.ama.txt. Only outbound calls are Crossref + NCBI (open APIs, no DataDome).
The HTML is thread-aware: one card per turn, nested TOC + scrollspy, citation popovers (AMA text), reference back-links with ×N counts, reading-progress bar, theme toggle, and toolbar ⬇ .bib / ⬇ CSL / ⬇ AMA downloads. A single answer is a 1-turn thread — same pipeline.
Preflight — is ego installed?
The capture step needs the ego-browser CLI. Check first:
command -v ego-browser >/dev/null 2>&1 && echo "EGO OK" || echo "EGO MISSING"
If EGO MISSING, guide the user through installing ego-lite following references/install.md — briefly: download the Mac build from https://lite.ego.app/download?auto=1, drag it into Applications, launch and complete onboarding (it auto-writes the ego-browser skill into ~/.claude/skills/ and migrates the user's login/cookies/profile — the source of the DataDome-trusted session), then /ego-browser + Full access. Re-run the check, then retry Round 2a. Do not substitute a headless browser — OpenEvidence sits behind DataDome-class protection and automated browsers get blocked; ego passes because it reuses the user's trusted session. Note: if a oe-<id>.dump.json already exists, Round 2b (transform) still runs without ego — offer that.