Case study · How it's built

An AI briefing that isn't allowed to make things up.

ScrapRival reads competitors' websites every day and writes a short briefing every Monday about what changed. Calling a model was the easy part. The work was making sure the briefing never says something the pages don't — on real, messy websites, with nobody checking it before it goes out.

Designed, built and run by Andrés Puentes González, AI engineer. In production since June 23, 2026.

ScrapRival is a portfolio project. It runs in production every day, but it isn't taking new accounts.

159
days in production
72
pages & feeds watched daily
1,449
page snapshots stored
912
changes classified
67%
of them dismissed as noise
50
briefings written

Live from the production database, refreshed hourly. Plus 12,329 blog and news items read through RSS.

01 /

Two loops: a daily radar and a Monday editor

Cheap, high-volume work runs every day on the smallest model. The expensive writing happens once a week per reader, and most of the chain around it exists to check the writing.

Every day · 06:00 UTC · Vercel Cron

  1. 1 FetchCheerio

    Every watched page and feed, behind an SSRF guard and an identifiable bot user agent.

  2. 2 Sanitycode

    Refuses captures that collapsed or came back as a placeholder page.

  3. 3 Diffcode

    Content-hash first; a snapshot is stored only when the page really changed.

  4. 4 RelevanceHaiku 4.5

    Signal or noise, a one-line summary and a 1–10 score, with scraped text fenced off as untrusted.

→ Snapshots and classified diffs in Postgres

Every Monday · queue drained by GitHub Actions

  1. 1 Selectcode

    Relevant changes of the week, max 3 per source so one churning page can't crowd out the rest.

  2. 2 ExtractHaiku 4.5

    Literal before/after facts from each diff. The writer may only cite numbers found here.

  3. 3 DraftSonnet 4.6

    The briefing, written for the reader's company and what they said matters to them.

  4. 4 CritiqueHaiku 4.5

    Checks every claim against the source material and lists what it can't support.

  5. 5 RepairSonnet 4.6

    Rewrites only the flagged sentences; the critic runs again on the result.

  6. 6 Guardcode

    Deterministic rules for claims no model check catches: actions and motives a diff can't prove.

→ One email at 08:00 in the reader's timezone

Underneath: Supabase Postgres with row-level security on every table and 17 versioned migrations; Resend and React Email for delivery, with opens and clicks fed back by a signed webhook; Sentry and consent-gated PostHog; a daily health check that fails loudly when the pipeline goes stale, and a weekly database backup that includes the auth tables, so a restore gives you a system people can actually log into.

See each step's trace on a real briefing

02 /

What broke, and what it taught the pipeline

Almost every layer of the chain exists because of a specific, dated failure on real data. Most of them weren't the model's fault — they started upstream, in what the model was given.

  1. 01 · Aug 12

    A difference between two captures is not an action

    A Shopify App Store listing shows exactly three reviews. A new one came in at the top, the oldest dropped off the bottom, and the briefing said the company “removed a critical negative review”. The critic signed it off: the sentence had no number in it to check.

    Fix A deterministic guard with an asymmetry built in: something appearing on a page is evidence, something disappearing is not. Claims of removal, and any motive attached to a change, get sent back for repair.

  2. 02 · Aug 13

    A 200 OK that wasn't the page

    A competitor's listing returned a 961-character courtesy page instead of the usual 6,934. The pipeline diffed one against the other and invented a story about the app vanishing from the store and returning the next day: two events that never happened, from one bad capture. The first one reached the email's subject line.

    Fix A sanity check between capture and diff, calibrated on the 226 snapshot pairs in production at the time: the worst real shrink was to 68.7 %, every capture below 26.1 % was garbage, and the 40 % threshold sits in the empty gap between them.

  3. 03 · Aug 5

    The news was what disappeared

    An AI coding tool quietly rewrote an already-published changelog entry to drop two integrations it had announced. The relevance model, tuned for what gets added, called it noise. But “deletion means signal” would have flooded the briefing: changelogs drop old entries every day as new ones push them off the page.

    Fix A syntactic detector for retractions: a line rewritten in place that loses named items, as opposed to whole blocks rotating out. It doesn't decide anything; it hands the model the evidence. Shipped with its own eval in November.

  4. 04 · Aug 20

    Competitors could write to the model

    The text of a competitor's page goes straight into the prompts. A company that knew it was being watched could add a line to its own page telling the model to classify its change as noise — and disappear from the radar, which is the entire product.

    Fix A trust boundary: scraped content travels inside explicit sentinels the prompts treat as hostile data, and any copy of the closing sentinel inside the scraped text is neutralised before it can be used to break out.

  5. 05 · Aug 7

    Briefings were being cut off mid-sentence

    The output cap was 1,800 tokens; a real briefing runs about 1,700. Some weeks it fit and some weeks the email just stopped. No error is raised when that happens.

    Fix Measured on real data with an eval rather than guessed, raised to 6,000 (you pay per generated token, not per cap), and the stop reason is now watched so a cut-off can't pass silently again.

  6. 06 · Aug 17

    The model invented how long a silence had lasted

    A published sample claimed a competitor had been quiet for weeks and drew a conclusion from it. The radar had been watching that company for three days.

    Fix Quiet streaks are computed by code from the capture history and only mentioned after 14 days. A test now fails on any duration claim in published samples, and the correction is printed on the sample page instead of quietly fixed.

  7. 07 · Aug 8

    300 seconds doesn't fit everyone

    The Sunday job wrote every briefing in series inside one serverless function. At about 74 seconds per briefing, that breaks at two to four accounts.

    Fix A queue in Postgres with leases, drained every ten minutes by GitHub Actions between Sunday night and Tuesday. Each briefing is claimed, written and stored independently, and delivered at 8:00 in the reader's own timezone.

03 /

How quality is kept honest

A fix that isn't measured is a guess. Each layer has a way of proving it still works.

Tests on every pull request

Over 500 Vitest tests, type-check, lint and a full production build run in CI before anything merges. Each failure above left a regression test behind, written from the real data that caused it.

Evals before touching a prompt

Ten eval suites run against real snapshots and real models: model comparisons for the writer, a fact-extraction ablation, the critic chain end to end, the retraction classifier and a seed check that fetches every new source the way production does.

Health that can't look green by accident

Every briefing stores a trace: tokens per step, what the critic flagged, what the guard caught, what was repaired and what wasn't. A critic that crashes no longer looks the same as a critic that approved a clean draft.

Audits with adversarial verification

Two full audits in August — security, reliability, product — where every finding had to survive an attempt to disprove it before anything was fixed. All P0 and P1 findings were closed.

04 /

Stack

App
Next.js 16 (App Router), React 19, TypeScript strict, Tailwind v4
Data
Supabase Postgres, row-level security, Supabase Auth
AI
Anthropic API — Haiku 4.5 to classify, extract and critique; Sonnet 4.6 to write
Capture
fetch + Cheerio, RSS, URL guard against SSRF
Email
Resend, React Email, signed one-click unsubscribe
Ops
Vercel, GitHub Actions (queue, health, backups), Sentry, PostHog
Billing
Lemon Squeezy with idempotent webhooks — switched off since it became a portfolio project

05 /

What I'd tell myself in June

  • Most LLM bugs are data bugs. The fixes that held were deterministic code around the model — sanity checks, guards, evidence computed in advance — not longer prompts.
  • Make every failure visible before making it rare. The worst bugs here raised no error: a truncated email, a critic that silently didn't run. The trace came before the fixes.
  • Engineering wasn't the bottleneck. The product worked months before anyone outside used it, and it never found paying customers. Next time, distribution starts the same week as the code.
  • AI agents need a team's guardrails. I built it with Claude Code as a pair programmer, under the same rules a team would use: small pull requests, CI, tests from real failures and written decisions. That is how one person shipped 200 commits and 50 PRs in four months without losing track of why anything is the way it is.

See it running on real competitors

Two markets, watched every day since August. Every briefing, every flagged claim, nothing edited.