SPB Git

spb/search-box Public

Agentic web research engine — hypotheses, verbatim evidence, contradictions, sourced answers streamed live. Claude Opus 5 + Firecrawl + PostgreSQL.

TypeScript 76.9% CSS 18.7% SQL 2.1% JavaScript 1.8% Shell 0.5%
5.5 KB · 137 lines markdown
Rendered Raw Blame History
1<div align="center">23<img src="apps/web/app/icon.svg" alt="Search-box.ai logo" width="110">45# Search-box.ai67</div>89<p align="center">10  <img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white">11  <img alt="Next.js" src="https://img.shields.io/badge/Next.js-15-000000?logo=nextdotjs&logoColor=white">12  <img alt="Claude" src="https://img.shields.io/badge/Claude-Opus_5-c8431a">13  <img alt="Firecrawl" src="https://img.shields.io/badge/Firecrawl-v2-ff6a00">14  <img alt="PostgreSQL" src="https://img.shields.io/badge/PostgreSQL-17-4169e1?logo=postgresql&logoColor=white">15  <img alt="Streaming" src="https://img.shields.io/badge/streaming-SSE_%2B_replay-157068">16  <img alt="Live" src="https://img.shields.io/badge/live-www.search--box.ai-157068">17</p>1819**Don't search the web. Search the answer space.**2021Search-box.ai is a multi-step, agentic web research engine. Given a hard question it22autonomously forms hypotheses, decomposes uncertainty, runs purposeful searches, opens23sources, extracts verbatim evidence, surfaces contradictions, updates beliefs — and streams24a fully sourced answer while you watch every step live.2526Built on the Anthropic Claude API (reasoning & orchestration) and Firecrawl (web27infrastructure). PostgreSQL holds the durable research state; every UI update corresponds28to a real backend event.2930---3132## Screenshots3334*A completed research session — the question blooms into objectives and claims, every node driven by a real backend event:*3536<img src="docs/screenshots/session-live.png" alt="Live research session: bloom graph, stats bar, timeline and streamed answer" width="100%">3738<table>39  <tr>40    <td width="62%" valign="top">41      <img src="docs/screenshots/home.png" alt="Home page — question composer" width="100%">42      <p align="center"><sub>Home — ask a question that deserves real research</sub></p>43    </td>44    <td width="23%" valign="top">45      <img src="docs/screenshots/mobile.png" alt="Mobile view — streamed answer" width="100%">46      <p align="center"><sub>Mobile-first, one-handed</sub></p>47    </td>48  </tr>49</table>5051---5253## Validated on a real research problem5455Benchmark question: *"Can transformer KV cache be compressed by an order of magnitude56without seriously harming model quality?"* — one autonomous session, no human steering:5758<p>59  <img alt="objectives" src="https://img.shields.io/badge/objectives-5-1a1712">60  <img alt="sources fetched" src="https://img.shields.io/badge/sources_fetched-11-1a1712">61  <img alt="verbatim evidence" src="https://img.shields.io/badge/verbatim_evidence-24-157068">62  <img alt="claims" src="https://img.shields.io/badge/claims-3-c8431a">63  <img alt="contradictions found" src="https://img.shields.io/badge/contradictions_found-1-c8431a">64</p>6566The engine assigned differentiated confidence per claim (40% / 85% / 90%), and caught a67genuine contradiction: a vendor blog presenting 8× compression as "comparable" quality for68a method whose peer-reviewed paper only claims lossless behavior up to 4×.6970## How it works7172```73question → understand objective → form hypotheses → decompose uncertainty74→ decide next action → use web tools → inspect evidence → update beliefs75→ identify gaps/contradictions → repeat → synthesize evidence-backed answer76```7778- **No fixed pipeline** — Claude decides research strategy through tool use; the app79  enforces safety: hard budgets, zod-validated tool contracts, SSRF guard,80  prompt-injection defense on all scraped content.81- **Claims & evidence are first-class objects** — verbatim quotes tied to falsifiable82  claims with stances (`supports` / `contradicts` / `context`) and probabilistic confidence.83- **Contradictions are a research success**, not an error state.84- **Provenance is never lost** — every answer sentence traces mechanically:85  `sentence → [n] marker → citation index → source → evidence → claim`.86- **Event-sourced UI** — the client replays the persisted event stream (SSE with87  `Last-Event-ID` recovery); nothing on screen is a fake progress animation.8889## Quick start9091```bash92pnpm install93cp .env.example .env        # ANTHROPIC_API_KEY, FIRECRAWL_API_KEY, DATABASE_URL94pnpm migrate                # apply PostgreSQL schema95pnpm dev                    # web app on http://localhost:300096```9798Run a session from the terminal:99100```bash101pnpm research "Your hard question here"102```103104## Repository structure105106```107apps/web            Next.js app (UI + API routes + SSE)108packages/agent      orchestrator loop, prompts, tools, session runner109packages/research   ResearchState service (claims, evidence, sources, contradictions)110packages/firecrawl  Firecrawl v2 adapter (search, scrape) + SSRF guard111packages/anthropic  Anthropic Messages API adapter (streaming)112packages/events     typed research event protocol113packages/db         PostgreSQL schema, migrations, repositories114packages/shared     shared types, zod schemas, budgets, ids115deploy/             ngrok config + start script (node m3u96a)116docs/               architecture, agent loop, research state, event protocol117```118119Full design notes in [`docs/architecture.md`](docs/architecture.md).120121## Deployment122123Production runs on node `m3u96a` behind an ngrok tunnel:124**https://www.search-box.ai** — see [`deploy/`](deploy/).125126---127128## Author129130**Simon-Pierre Boucher**131📫 [contact@spboucher.ai](mailto:contact@spboucher.ai)132133<img alt="author" src="https://img.shields.io/badge/author-Simon--Pierre_Boucher-1a1712">134<img alt="contact" src="https://img.shields.io/badge/contact-contact%40spboucher.ai-c8431a">135136© 2026 Simon-Pierre Boucher. All rights reserved.137