Decoupled single-shot RAG answer engine and automated multi-stage AI reasoning pipeline that filters, evaluates, and synthesizes web sources into verifiable Trust Reports.
The backend architecture of Nogeo/The Glass Box operates as a specialized analytical software application rather than a conversational chatbot. It ingests raw search results, evaluates information authority, performs dual data extraction, executes single-source forensic analysis, and strings together a composite cross-document consensus matrix. The entire pipeline runs sequentially and evaluates safety layers to provide an end-to-end verifiable snapshot.
[Search Payload] ➔ [P1: Triage Selector] ➔ [Playwright Crawler]
│
[P5: Tracer] ◀ [P4: Synthesizer] ◀ [P3: Auditor] ◀ [P2: Extractor]
- Runtime & Framework: Node.js, Express, TypeScript (Target:
ES2022, Module:NodeNext). - Database & Database ORM: Supabase (PostgreSQL engine) connected through Prisma ORM.
- Orchestration & Model Stack: LangChain framework deploying
deepseek-chatmodels with structural JSON forcing. - Ingestion Layer: Playwright with
puppeteer-extra-plugin-stealthfor scraping, combined with cheerio and turndown for text conversion. - Data Guard & Schema Validation: Zod schema constraints to enforce strict format types (
Stage1AnalysisSchema,FinalAnswerSchema).
The core intellectual property consists of 5 modular, single-responsibility pipelines orchestrated sequentially:
- P1: The Triage Prompt (
p1-triage.txt) Filters incoming unstructured payloads to drop streaming/video networks and isolates exactly the top 7 high-authority target URLs. - P2: The Relevance Extraction Prompt (
p2-relevance-extraction.txt) Executes a dual-pass extraction script returning literal matches mapped directly to target queries, as well as a forensic block checking for authorship, dates, and black-hat updates. - P3: The Stage 1 Analysis Prompt / The Auditor (
p3-stage1-analysis.txt) Inspects each separate document to assign dynamic authority configurations (authorityScore), checks for prompt injection compromises, and references site infrastructure parameters (llms.txt). - P4: The Stage 2 Synthesis Prompt / The Synthesizer (
p4-stage2-synthesis.txt) Evaluates facts cross-referencing all 7 sources simultaneously to deduce a mathematicalconsensusScorewhile docking parameters for conflicting claims. - P5: The Final Answer Prompt / The Reporter (
p5-final-answer.txt) Maps literal phrases to an atomic trace layout, building the end-user facing transparency log.
Contributors must replicate variables locally. Create a .env file in the project's root matching the layout below:
# Server Port Mapping Configuration
PORT=3000
NODE_ENV=development
# Database & Authentication Engines (Supabase Provider)
DATABASE_URL="postgresql://postgres:[YOUR_PASSWORD]@db.[YOUR_REF][link removed]"
SUPABASE_URL="[link removed]"
SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsIn..."
# LLM Framework & Computational Partners
DEEPSEEK_API_KEY="sk-..."
BRIGHT_DATA_SEARCH_KEY="your-bright-data-token"
# Billing Infrastructure Interface
STRIPE_API_KEY="sk_test_..."
Critical Warning: The version control rules explicitly filter
.envtracking blocks. Never swap out placeholder targets with production production keys when committing edits to open-source branches.
Install all standard framework requirements and underlying stealth scraping components using Node Package Manager:
npm install
Generate schemas and bind structural models against your Supabase deployment through Prisma's toolchain:
npx prisma generate
npx prisma db push
The prompt systems are validated using a custom automated harness file (sprint0-test.ts) before compiling the main distribution bundle:
npm run dev
Compile TypeScript assets down into high-performance native ECMAScript source modules within the ./dist folder:
npm run build