Under the hood

How Sharp turns a goal into a cited signal

Under the hood, Sharp is Edge Desk — a small agency of domain-specialist AI agents that watches Polymarket order books and fresh real-world evidence, flags markets whose odds lag reality, and ships a cited alert. It never places the trade for you. Here is the exact loop, end to end.

Trigger Route Gather Match Alert Track Score
The pipeline

One inspectable loop, eight steps

Every alert is fully traceable — each step below persists its inputs, status, latency and cost to PostgreSQL, so any run can be opened end to end.

01

A trigger comes in

A live event feed (a goal, an injury, breaking news), a manual market check, or a versioned replay fixture hits the ingest API. Every event carries a stable sourceEventId for deduplication and keeps occurredAt separate from receivedAt.

Fastify 5POST /v1/events/v1/market-checks/v1/replays
02

Persisted & dispatched

The API validates and writes the event plus an initial run durably and idempotently, then returns 202 Accepted with a runId — it doesn't block on the agents. Re-posting the same key returns the existing run with duplicate: true.

PostgreSQLnode-postgres (pg)idempotency key202 runId
03

Hermes routes it to a specialist

The Hermes orchestrator loads market config and baseline, then routes the event to one domain specialist — sports, geopolitics or crypto. Reading a red card is nothing like reading an election injunction, so each is its own agent, yet all emit the same normalized signal contract.

Hermes (Nous Research)delegation · croncategory router
04

Price & evidence, in parallel

Shared adapters fan out at once: Polymarket snapshots (price, best bid/ask, spread, depth) over the CLOB WebSocket, and fresh cited evidence from Linkup or a live feed. Every fact keeps its source and retrieval timestamp — a current price alone can never establish lag without a pre-event baseline.

Polymarket CLOB (WS)Gamma · DataLinkupfreshness ts
05

The matcher decides

A hybrid lag detector joins the signal to the market outcome. Deterministic code owns the price math, thresholds and final safety gates; a model assists only with feature extraction and the human-readable reason. It emits notify, ignore or needs_review — never a trade.

scoring · sports-v1deterministic gatesOpenAI (assist)
06

A cited alert is sent

A notify decision writes an alert and an outbox row in one transaction. A sender worker claims the job with row-locking, composes the card and delivers it through the Hermes Telegram gateway — an idempotency key stops two workers double-sending the same alert.

delivery outboxTelegram gatewayidempotency keynotification-only
07

Outcomes are tracked

Once sent, the tracker schedules price checks at +10, +20 and +40 minutes from the send time. Each labels the call correct, wrong, flat or invalid_data under a versioned policy — and records lateness rather than silently shifting the horizon.

outcome jobsscheduled tasks+10 / +20 / +40
08

The scoreboard adds it up

The public scoreboard reports directional hit rate at each horizon, median move and sample size — with a versioned metric definition, and live results kept separate from replay. No cherry-picking a favorable horizon.

Postgres aggregateslabeled hit ratelive ≠ replay
System architecture

How the pieces fit together

Everything is arranged around one hub: PostgreSQL. Triggers enter through the API; market data and evidence enter through Hermes; specialists write their signals to the database, and every downstream worker reads from it. Follow the arrows.

free or paid Management UI / CLI select · pause · thresholds Live event feeds Replay harness versioned fixtures Polymarket Gamma · CLOB · Data Linkup / source APIs fresh evidence Ingest API — Fastify /events · /market-checks · /replays HERMES ORCHESTRATOR Category router / reviewer ⚽ Sports specialist goals · cards · MVP 🏛️ Geopolitics elections · rulings 🪙 Crypto listings · liquidations PostgreSQL system of record Matcher / lag detector rules + model assist Alert sender outbox + card composer Outcome tracker +10 / +20 / +40 min Scoreboard labeled hit rate Channel entitled? Telegram via Hermes gateway
data & dispatch flow write-back to Postgres triggers → API data/evidence → Hermes PostgreSQL hub
The core calculation

Measuring the lag

The matcher's job is one question: has reality moved faster than the market? It answers deterministically, in basis points, and only then does a model write the explanation.

// observed repricing since the event, in basis points
observedMoveBps = (currentPrice − preEventPrice) × 10_000
// direction: +1 for an upward signal, −1 for downward
signedObservedMoveBps = observedMoveBps × signalDirection
// the edge the market hasn't priced in yet
lagBps = expectedMoveBps − signedObservedMoveBps
Worked example — England scores at 63'. The model expects a 9-point move; the market has only moved 2.5.
Expected
+900
Observed
+250
Remaining lag
+650
→ BUY YES · 78% confidence. A cited card goes to Telegram; the trade stays yours to place.
It only notifies when every gate passes
Evidence confidence meets the market threshold
Evidence & price snapshots are within freshness limits
Baseline predates the event; current snapshot follows it
Spread is at or below the configured maximum
Depth / liquidity meets the configured minimum
lagBps meets the minimum in the predicted direction
No matching alert inside the cooldown window
No hard risk flag is present
Tech stack

Everything it's built on

Pulled straight from the money-scouts monorepo — a TypeScript workspace of focused apps and packages.

Runtime & tooling
  • TypeScript 5.7 across every package
  • Node.js ≥20, native ESM modules
  • tsx for dev execution
  • npm workspaces monorepo — apps/* + packages/*
Ingest API
  • Fastify 5 — HTTP ingest server
  • Routes: events, marketChecks, replays
  • dotenv config
  • Idempotent, 202-fast dispatch
Data
  • PostgreSQL — system of record
  • node-postgres (pg 8) pool
  • SQL migrations · jsonb + timestamptz
  • Transactional outbox pattern
Orchestration & agents
  • Hermes (Nous Research) — delegation, Kanban, cron
  • Specialists: sports, geopolitics, crypto
  • Workers: orchestrator · matcher · alertSender · outcomeTracker
Market & evidence
  • Polymarket — Gamma, CLOB (WS+REST), Data
  • Linkup — fresh cited evidence
  • Deterministic lag detector · policy sports-v1
  • OpenAI — matcher extraction & explanation (assist)
Delivery & hosting
  • Telegram via the Hermes gateway
  • Dodo entitlements — optional, downstream
  • Landing on Cloudflare Pages / Vercel
  • Versioned replay fixtures for demos & regression
Notification-only by design — a future trade executor stays fully isolated from analysis, messaging and signing keys.

That's the whole loop.

Trigger to cited alert to scored outcome — every step inspectable.

Start free trial