1- # MedCore Research Builder v2
1+ # Aletheia Research OS (v4)
22
33[ ![ CI] ( https://github.com/Abdulsalam3302/medcore-research-builder/actions/workflows/ci.yml/badge.svg )] ( https://github.com/Abdulsalam3302/medcore-research-builder/actions/workflows/ci.yml )
44
5- A free, no-login, reporting-guideline-driven workspace for building the core of a ** medical research manuscript** . Built for clinicians and researchers worldwide — drafts stay in your browser; scholarly lookups run server-side.
5+ ** The AI research operating system for medical science.** State a research goal and Aletheia's
6+ specialist agents plan, draft, critique, and refine every deliverable — study design, protocol,
7+ SAP, IRB pack, runnable analysis, manuscript, cover letter, reviewer responses, poster, slides,
8+ graphical abstract — with an automated reviewer gating every stage and a provenance record on
9+ every artifact.
610
7- ** Live app:** https://medcore-research-builder.vercel.app
11+ * Aletheia* (ἀλήθεια) is the Greek word for truth — the state of not being hidden. This is the
12+ next version of ** MedCore Research Builder** : same non-negotiable integrity rules, a new agentic
13+ core.
14+
15+ ** Live app:** https://medcore-research-builder.vercel.app
816** Repository:** https://github.com/Abdulsalam3302/medcore-research-builder
917
10- ## What’s new in v3.10
11-
12- - ** Library Navigator** — one deterministic search across all 363 library
13- entries (185+ skills, 12 workflows, 69 tips, 29 open-source tools, 57 MCP
14- servers, 9 built-in features): answer two guided questions (stage + kind of
15- help) or type a goal, get a ranked shortlist with match reasons, inline
16- skill steps, official verify links, and jump-to-lane buttons. Offline,
17- instant, can never hallucinate an entry. New lane under Quality & Empowerment.
18- - ** Catalog upgrades (verified, deduplicated)** — MCP: official Hugging Face
19- and Figma servers, NPI Registry (NPPES), Mermaid diagrams, World Bank Open
20- Data. Open-source tools: jamovi, OSF, Pandoc, OpenRefine, ASReview,
21- PRISMA2020 flow diagram. Skills: ICMJE-aligned AI-use disclosure, ORCID
22- researcher identity. Every entry keeps the no-fabrication rule: an official
23- verify link, honest confidence labels.
24- - ** Protocol is generated, not uploaded** — the Studio and readiness ladder
25- now lead with * Generate* (design-aware skeleton or AI draft built for you);
26- * Upload existing* stays as a clearly-labelled option for documents you
27- already have. Research Launch gains a "Generate my protocol →" next step.
28-
29- ## What’s new in v3.9
30-
31- - ** Submission Pipeline** — track every target journal from shortlist →
32- formatting → submission → peer review → revision → acceptance → publication,
33- with stage-by-stage best practice (ICMJE/COPE-aligned), duration stats, and
34- a full status timeline. New lane under Post-Research.
35- - ** Publication Club** — a community board (new Community phase): post and
36- join research opportunities, meet researchers by specialty, and share
37- MedCore projects via tokenized share links so studies are initiated * and*
38- finished on the platform. Supabase-backed (` docs/CLUB_TABLES.sql ` ), browse
39- as guest, post/join with a free account; plain-text only, RLS-enforced,
40- strict rate limits.
41- - ** DOAJ integration** — ` /api/doaj/search ` (articles + journals) and a new
42- ` check_open_access_journal ` MCP tool: verify a journal's DOAJ listing
43- (license, APC, publisher) as a legitimacy signal for the predatory check.
44- - ** Security** — HSTS header (2-year max-age) added to the middleware
45- security set; community endpoints are auth-gated, length-capped,
46- control-character-stripped, and rate-limited.
47-
48- ## What’s new in v3.8
49-
50- - ** First-party MCP server** — MedCore's engines (journal finder, design
51- registry, reference verification, coherence checks, preprint search) are now
52- exposed to any Model Context Protocol client at ` /api/mcp `
53- (Streamable HTTP, stateless). See [ ` docs/MCP_SERVER.md ` ] ( docs/MCP_SERVER.md ) .
54- ``` bash
55- claude mcp add --transport http medcore https://medcore-research-builder.vercel.app/api/mcp
56- ```
57- - ** Preprint search API** — ` /api/preprints/search ` queries bioRxiv/medRxiv and
58- other preprints via Europe PMC's ` SRC:PPR ` source (free, keyless), with
59- explicit * not peer reviewed* labelling.
60- - ** Lint gate** — ` npm run lint ` (next/core-web-vitals) now passes clean and
61- runs in CI; React hook dependency hazards fixed.
62- - ** Sync you can trust** — cloud-sync failures and local-storage save failures
63- now surface as visible alerts (including on mobile) instead of failing silently.
64-
65- ## What’s new in v3
66-
67- - ** Journal Finder** — a deep journal-suggestion engine over WoS SCIE/ESCI,
68- Scopus, PubMed/MEDLINE, PMC, and DOAJ, with a curated ** 100%-Saudi** journal
69- set, relevance + indexing ranking, filters, official verify links, and
70- per-journal ** submission formatting** . Scales to tens of thousands via
71- ` scripts/ingest-journals.mjs ` (OpenAlex/DOAJ/Crossref) → ` lib/journals/generated.ts ` .
72- - ** Manuscript Coherence** — treats the manuscript as one connected unit:
73- checks title↔content, design↔claims, objective↔conclusion, results↔discussion
74- (numbers + causal language), citation ** order** , and cited-vs-listed integrity.
75- - ** Protocol / Proposal Studio** — the platform * develops* protocols (offline
76- skeleton + AI draft), design-aware (SPIRIT/PRISMA-P/STROBE/STARD/TRIPOD/CARE).
77- - ** Figures & Results upgrade** — figure-type recommendation with caption/legend/
78- footnotes, a Table 1 scaffold, and AI-assisted results interpretation that
79- foregrounds effect size + CI and never fabricates numbers.
80- - ** Reference Safety** — an anti-hallucination layer flagging unverified,
81- low-confidence, irrelevant, or retracted citations for human review.
82- - ** Language Studio** — academic editing that preserves meaning and every
83- number, with honest (non-guarantee) readability / AI-pattern / originality aids.
84- - ** Instant auth** — sign-up with no email confirmation (auto sign-in); full
85- guest mode with zero registration. See ` docs/AUTH_SETUP.md ` .
86- - ** Durable rate limiting** (Upstash) + ** tokenized share links** .
87- - ** Tests** — ` npm run test:smoke ` and ` npm run test:auth ` .
88-
89- ### From v2
90-
91- - ** 63 study designs** , ** 34 journals** , ** 84 feature flags** via the design registry
92- - ** Research Launch** readiness scoring; ** Title Lab** novelty scan
93- - ** Reference Verifier** across PubMed, Crossref, OpenAlex, Europe PMC, Semantic Scholar, Unpaywall
94- - ** Quality Suite** , ** Reviewer Simulator** , ** Statistician Copilot** , ** Flow Diagram Builder**
95- - ** Version history** , ** DOCX export** , ** system status panel** , security headers
96-
97- ## Core principles
98-
99- - ** Never fabricate** PMIDs, DOIs, statistics, or citations
100- - ** Checklist-driven** against EQUATOR reporting guidelines (CONSORT, STROBE, PRISMA, SPIRIT, STARD, TRIPOD, CARE, etc.)
101- - ** Transparent LLM outputs** — missing data is flagged, not invented
102- - ** Privacy-first** — no account required; in guest mode drafts stay in your browser with no server-side storage. Optional Supabase sign-in enables cloud sync, which stores your draft server-side only while you are signed in.
18+ ## What's new in v4 (Aletheia)
19+
20+ - ** Research Autopilot** — an agentic pipeline console inspired by autonomous-scientist systems
21+ (Sakana AI Scientist). An orchestrator agent decomposes your goal into staged deliverables;
22+ each stage runs a quality loop: * draft N independent candidates → reviewer critiques & selects →
23+ specialist refines → strict review gate scores against explicit acceptance criteria* . Stages
24+ advance only when their dependencies are approved. Pipeline graph, live stage status, run log,
25+ and a visible token budget.
26+ - ** Provenance on every artifact** (Claude-Science-style) — inputs used, models involved, token
27+ counts, estimated cost, checks passed/failed, and the full step trace. Nothing is a black box.
28+ - ** Deliverable Studios** — the full freelancer-replacement set, one deliverable at a time, each
29+ produced through the same quality loop: Study Design Dossier, Protocol, Statistical Analysis
30+ Plan, IRB/Ethics Pack, Runnable Analysis Code, Full Manuscript, Abstract, Cover Letter,
31+ Response to Reviewers, print-ready Poster (HTML→PDF), Conference Slide Deck, Graphical
32+ Abstract, Illustration Brief.
33+ - ** Research Advisor** — interactive methodology/strategy consultations grounded in your actual
34+ project, citing the applicable standard (EQUATOR, ICMJE, COPE, GRADE) with the strongest
35+ counter-consideration.
36+ - ** Runnable Analysis Lab** — reproducible statistics in the browser via Pyodide (WebAssembly):
37+ pandas, numpy, scipy, statsmodels, matplotlib. Upload a CSV, run the statistician agent's
38+ script locally — data never leaves your machine.
39+ - ** Cost-effectiveness layer** — model routing by task complexity (light/standard/deep): cheap
40+ models handle mechanical steps, strong models handle reasoning. Per-run token budget with soft
41+ limits and cost estimates.
42+ - ** Real URL routes** — every lane is addressable (` /w/autopilot ` , ` /w/methods ` ,
43+ ` /w/journal-finder ` …), shareable, and back/forward-friendly.
44+ - ** New identity & design** — Aletheia wordmark, Space Grotesk display type, indigo/cyan
45+ "scientific instrument" palette; dark console surfaces for the agentic lanes, light paper
46+ surfaces for writing lanes.
47+
48+ Everything from MedCore v3 remains and is integrated as tools the agents and you share: Journal
49+ Finder, Reference Verifier + Safety, Manuscript Coherence, Quality Gates, Submission Pipeline,
50+ Publication Club, Library Navigator (363 entries), first-party MCP server, and the rest.
51+
52+ ## Core principles (unchanged since day one)
53+
54+ - ** Never fabricate** PMIDs, DOIs, statistics, or citations — missing facts are flagged
55+ ` [REQUIRED] ` , never invented
56+ - ** Checklist-driven** against EQUATOR reporting guidelines (CONSORT, STROBE, PRISMA, SPIRIT,
57+ STARD, TRIPOD, CARE, …)
58+ - ** Human in control** — agents assist and are gated; the researcher decides the science
59+ - ** Privacy-first** — no account required; guest drafts and pipeline runs stay in your browser;
60+ cloud sync is opt-in; analysis data never leaves the machine
10361
10462## Tech stack
10563
10664| Layer | Technology |
10765| -------| ------------|
10866| Framework | Next.js 14 (App Router) |
10967| UI | React 18, TypeScript, Tailwind CSS |
110- | State | Browser ` localStorage ` only |
111- | Export | DOCX, Markdown, CSV, JSON |
112- | Charts | Plotly (CDN) |
68+ | Agent engine | Stateless ` /api/pipeline/* ` ops + client-owned run state |
69+ | In-browser stats | Pyodide (WebAssembly Python) |
70+ | State | Browser ` localStorage ` (optional Supabase cloud sync) |
71+ | LLM providers | MiniMax (default), Anthropic, OpenAI — routed by task complexity |
72+ | Export | DOCX, Markdown, CSV, JSON, HTML (poster/slides/graphical abstract), PY |
11373| Deploy | ` output: "standalone" ` — Vercel, Railway, or any Node host |
11474
11575## Getting started
@@ -122,110 +82,80 @@ npm run dev
12282# Open http://localhost:3000
12383```
12484
125- If port 3000 is stuck with a stale process (API 404, broken CSS), kill old Node processes and restart:
126-
127- ``` bash
128- lsof -ti :3000 | xargs kill -9 2> /dev/null; npm run dev
129- ```
130-
13185## Environment variables
13286
133- See ` .env.example ` . The app degrades gracefully when optional keys are missing.
87+ See ` .env.example ` . The app degrades gracefully when optional keys are missing — without an LLM
88+ key the scholarly engines, reference verification, deterministic pipeline planning, and the
89+ Pyodide analysis lab still work.
13490
13591| Variable | Required | Purpose |
13692| ----------| ----------| ---------|
13793| ` LLM_PROVIDER ` | optional | ` minimax ` (default), ` anthropic ` , or ` openai ` |
13894| ` MINIMAX_API_KEY ` | recommended | Default LLM provider |
13995| ` ANTHROPIC_API_KEY ` | optional | Anthropic LLM |
14096| ` OPENAI_API_KEY ` | optional | OpenAI fallback |
141- | ` NCBI_API_KEY ` | optional | PubMed rate limit 3→10 req/s |
142- | ` NCBI_EMAIL ` · ` NCBI_TOOL ` | recommended | NCBI polite identification |
143- | ` CROSSREF_MAILTO ` | recommended | Crossref polite pool |
144- | ` OPENALEX_MAILTO ` | recommended | OpenAlex polite pool |
145- | ` OPENALEX_API_KEY ` | optional | OpenAlex premium limits |
146- | ` SEMANTIC_SCHOLAR_API_KEY ` | optional | S2 higher rate limits |
147- | ` UNPAYWALL_EMAIL ` | optional | Open-access PDF links in reference verifier |
148- | ` TAVILY_API_KEY ` or ` SERPAPI_API_KEY ` | optional | Web search in Title Lab novelty scan |
149- | ` ELICIT_API_KEY ` | optional | Elicit AI search (paid) |
150-
151- Without an LLM key: scholarly APIs, reference verification, stats engine, and heuristic parsers still work. Drafting features show a “configure LLM” message.
97+ | ` LLM_MODEL_LIGHT ` / ` LLM_MODEL_STANDARD ` / ` LLM_MODEL_DEEP ` | optional | Override the cost router's model per complexity tier |
98+ | ` NCBI_API_KEY ` · ` NCBI_EMAIL ` · ` NCBI_TOOL ` | recommended | PubMed limits + polite identification |
99+ | ` CROSSREF_MAILTO ` · ` OPENALEX_MAILTO ` | recommended | Polite API pools |
100+ | ` SEMANTIC_SCHOLAR_API_KEY ` · ` OPENALEX_API_KEY ` | optional | Higher rate limits |
101+ | ` UNPAYWALL_EMAIL ` | optional | Open-access PDF links |
102+ | ` TAVILY_API_KEY ` or ` SERPAPI_API_KEY ` | optional | Web search in Title Lab |
152103
153104## Testing
154105
155106``` bash
156- # Type check
157- npm run typecheck
158-
159- # Production build
160- npm run build
161-
162- # API smoke tests (dev server must be running)
163- npm run test:smoke
164- # Or against a specific port:
165- BASE_URL=http://localhost:3006 npm run test:smoke
107+ npm run typecheck # TypeScript
108+ npm run lint # next/core-web-vitals
109+ npm run build # production build
110+ npm run test:smoke # 26 API smoke tests (dev server must be running)
166111```
167112
168- ### Manual checks
113+ ## The pipeline loop (how Autopilot works)
169114
170- ``` bash
171- curl http://localhost:3000/api/status
172- curl ' http://localhost:3000/api/pubmed/search?q=heart+failure&retmax=3'
115+ ```
116+ goal ──► orchestrator plans stages (DAG with dependencies)
117+ │
118+ ▼ per stage, owned by a specialist agent
119+ draft N candidates ──► reviewer critiques & selects best
120+ ▲ │
121+ │ ▼
122+ refine against feedback ◄── review gate (score vs acceptance criteria)
123+ │
124+ pass ──► stage approved, artifact + provenance saved
125+ revise ─► one bounded fix cycle, then re-gate
126+ fail ──► stage rejected for human decision
173127```
174128
175- In the UI: ** Reference Verifier → Load demo → Verify** and ** Title Lab → Load demo → Check similarity** .
176-
177- ## Workflow
178-
179- 1 . ** Research Launch** — team, IRB, budget, readiness score
180- 2 . ** Research Type** — pick design, journal, features → guideline recommendation
181- 3 . ** Title Lab** — PICO, novelty scan, refinement
182- 4 . ** Manuscript sections** — Introduction → Methods → Results → Discussion → Conclusion
183- 5 . ** References** — parse & verify across scholarly APIs
184- 6 . ** Quality / Compliance / Export** — review, report, DOCX
129+ Specialists: Study Designer, Methodologist, Statistician, Medical Writer, Scientific Designer,
130+ Research Advisor — all gated by the Automated Reviewer, all bound by the same integrity rules.
185131
186132## Project layout
187133
188134```
189135app/
190- api/ # 40 server routes (LLM, scholarly, agents, registry)
191- page.tsx # Dashboard shell
192- components/ # Feature UI (20+ panels)
136+ api/ # ~45 server routes (pipeline, LLM, scholarly, agents, registry)
137+ w/[[...lane]]/ # Real URL routes for every workspace lane
138+ components/
139+ pipeline/ # Autopilot console, Studios, Advisor, Analysis Lab, Provenance UI
193140lib/
194- registry/ # Designs, journals, features (v2)
195- scholarly/ # PubMed, Crossref, OpenAlex, etc.
196- agents/ # Stats, evidence, retraction, figures
197- store.ts # localStorage persistence
198- scripts/
199- smoke-test.mjs # API smoke tests
200- middleware.ts # Security headers
201- ```
202-
203- ## Deployment (public)
204-
205- ** Production:** https://medcore-research-builder.vercel.app
206-
207- Hosted on Vercel (Next.js standalone). Environment variables are set in the Vercel project dashboard — never commit ` .env.local ` .
208-
209- To sync local env to Vercel (maintainers only):
210-
211- ``` bash
212- ./scripts/sync-vercel-env.sh .env.local
213- vercel deploy --prod
141+ pipeline/ # Agent roster, deliverable specs, orchestrator, cost router, types
142+ registry/ # 63 study designs, journals, features
143+ scholarly/ # PubMed, Crossref, OpenAlex, Europe PMC, DOAJ, …
144+ swarm/ # v3 peer-review swarm (Review & Improve lane)
145+ middleware.ts # Security headers (CSP incl. Pyodide wasm allowances)
214146```
215147
216- Before going public:
148+ ## Deployment
217149
218- 1 . Set all env vars in the host dashboard (never commit ` .env.local ` )
219- 2 . Run ` npm run build && npm run test:smoke ` against the deployed URL
220- 3 . Set ` CROSSREF_MAILTO ` , ` OPENALEX_MAILTO ` , ` NCBI_EMAIL ` for polite API pools
221- 4 . Consider adding ` TAVILY_API_KEY ` for Title Lab web search
222- 5 . Monitor rate limits — defaults are ~ 24 LLM req/min/IP, 12 verify/min/IP
223- 6 . (Optional) For server-stored share links, run [ ` docs/SHARE_TABLE.sql ` ] ( docs/SHARE_TABLE.sql ) in Supabase — without it, sharing falls back to inline URL-fragment links
150+ Hosted on Vercel (Next.js standalone). Set environment variables in the host dashboard — never
151+ commit ` .env.local ` . Before going public: run ` npm run build && npm run test:smoke ` , set the
152+ polite-pool emails, and monitor rate limits (~ 24 LLM req/min/IP by default).
224153
225154## License
226155
227- MIT — see [ LICENSE] ( LICENSE ) . MedCore is independent of EQUATOR Network, NCBI, Crossref, and OpenAlex.
156+ MIT — see [ LICENSE] ( LICENSE ) . Aletheia is independent of the EQUATOR Network, NCBI, Crossref,
157+ OpenAlex, Clarivate, Scopus, Sakana AI, and Anthropic.
228158
229159## Contact
230160
231- Founder: Abdulsalam Aleid — feedback via the in-app contact links or GitHub issues.
161+ Founder: Dr. Abdulsalam Aleid — feedback via the in-app contact links or GitHub issues.
0 commit comments