Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AnswerScan

AnswerScan is an AI visibility audit engine. It queries multiple AI search engines with the same prompt and returns web-grounded answers side by side, so you can see how your brand or product appears across different AI platforms.

Day 1: Engine Proof-of-Concept

This phase proves that 4 AI engines can be queried in parallel with a single prompt and return real, web-grounded answers.

Engines:

  • Claude (Anthropic) — claude-sonnet-4-5 with web_search_20250305 tool
  • OpenAI — gpt-4.1 via Responses API with web_search_preview tool
  • Grok (xAI) — grok-4 via Agent Tools API (/v1/responses + web_search tool)
  • Gemini (Google) — gemini-2.5-flash with googleSearch grounding

Setup

1. Add API keys

Edit .env.local in the project root and replace the placeholders:

ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
XAI_API_KEY=xai-...
GEMINI_API_KEY=AIza...
FIRECRAWL_API_KEY=fc-...

.env.local is git-ignored and will never be committed.

2. Install dependencies

npm install

Running the engine test

npm run test:engines

This runs scripts/test-engines.ts which:

  1. Sends the test prompt to all 4 engines in parallel
  2. Prints each engine's response to the terminal
  3. Logs total elapsed time
  4. Writes the full JSON result (including raw API responses) to output/test-run-<timestamp>.json

What to look for in the output

A successful run shows:

  • 4 engine blocks each labeled [CLAUDE], [OPENAI], [GROK], [GEMINI]
  • Real brand names — e.g. "Weave", "Podium", "Luma", "Arini" for dental AI receptionists
  • Evidence of web search — citations, recent product names, or "as of 2024/2025" references
  • No ERROR: prefixes — if you see one, check the relevant API key in .env.local

Running a full audit

npm run audit -- example.com "attribute1,attribute2,attribute3"

Example:

npm run audit -- linear.app "issue tracking,project management,fast,developer-focused,keyboard shortcuts"

The audit pipeline:

  1. Scrapes the brand's homepage via Firecrawl
  2. Detects 5 direct competitors using Claude + web search
  3. Generates 50 buyer prompts across 5 buckets (Category, Feature, Comparison, Use-case, Problem)
  4. Runs all 50 prompts × 4 engines = 200 queries in parallel (concurrency 20)
  5. Classifies each response: cited / position / quality
  6. Computes an overall AI visibility score (0–100)
  7. Prints a terminal summary and writes full JSON to output/audit-<domain>-<timestamp>.json

Score components

Component Weight Description
Citation rate 40% % of prompts where brand was mentioned
Quality score 40% Weighted by citation quality (a–d) and position (1–4)
Engine coverage 20% Harmonic mean of per-engine citation rates

Score labels

Score Label
80+ Dominant
60–79 Strong
40–59 Visible
20–39 Spotty
< 20 Invisible

Project structure

answerscan/
├── lib/
│   ├── engines.ts          # 4 engine query functions
│   ├── scrape.ts           # Firecrawl homepage scraper
│   ├── competitors.ts      # Claude-powered competitor detection
│   ├── prompts.ts          # 50-prompt generator (5 buckets)
│   ├── classifier.ts       # Haiku citation classifier
│   └── scoring.ts          # Score computation
├── scripts/
│   ├── test-engines.ts     # Quick engine smoke test
│   └── audit.ts            # Full audit pipeline
├── output/                 # JSON results (git-ignored)
├── app/                    # Next.js App Router (UI — future phases)
└── .env.local              # API keys (git-ignored)

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages