Problem
Research questions need web + academic + visual + code sources fused — single-source answers hallucinate or miss contradictions.
Approach
4-layer engine: intent classification + decomposition → multi-mode search executor (web, academic, visual, code) → pipeline (dedupe, rerank, cross-source fusion, contradiction detection). Service on Hono with Zod schemas, p-queue concurrency, Readability + linkedom extraction, pdf-parse ingestion, msgpackr cache.
Code
From src/pipeline.ts — every layer wires through one pipeline object:
import { sanitizeQuery } from "./layers/layer0/index.js";
import { assessComplexity } from "./layers/layer1/fast-path.js";
import { assemblePlan } from "./layers/layer1/index.js";
import { classifyIntentLocal } from "./layers/layer1/intent-classifier.js";
import { ExecutionController } from "./layers/layer2/index.js";
import { executePlan, extractContent } from "./layers/layer3/index.js";
import {
buildResponse,
deduplicateResults,
detectContradictions,
rerankResults,
} from "./layers/layer4/index.js";
import { ResultCache } from "./layers/layer5/index.js";
import { CostTracker } from "./layers/layer5/index.js";
import { SessionManager } from "./layers/layer6/index.js";
import { KnowledgeGraph } from "./layers/layer6/index.js";
import { ThompsonSamplingBandit } from "./layers/layer7/bandit.js";
// …constructor wires controller, cache, cost tracker,
// sessions, knowledge graph, and a bandit that learns
// which search mode works per query type
export class ResearchPipeline { /* …full class in repo */ }
Preview
Live demo isn’t deployed — run it locally in ~2 minutes: clone the repo, install per the README, send a query, watch intent → multi-mode search → fused response with contradiction flags. Recorded GIF walkthrough lands in L2.
Results
Working multi-source pipeline with compact caching and contradiction flags. Validated approach via Bench 0/10 mock baseline (contracts reject weak answers).
Links
- Code: https://github.com/dnarsh/research-engine
- Eval: /projects/deep-research-bench