← Esteban GuerraOpen the live app ↗
Case study — 02

HedgePredict.

The best play on Polymarket, and why.

A read-only prediction-market companion. A calibrated model makes the call, Claude explains it and grounds it in the news, and an MCP server lets any AI use the whole engine.

Role
Solo — product, design, engineering
Stack
Next.js 16 · TypeScript · Tailwind v4 · Vercel
Year
2026
Status
Live
01 — The problem

Hundreds of markets. No idea which one matters.

Polymarket lists hundreds of live markets at any moment. Finding the few where the crowd's price looks wrong means reading odds, liquidity, price history and the news behind all of it.

Most tools either dump raw data on you or want your wallet so they can place trades. I wanted the opposite: a companion that tells you the play and why, then sends you to Polymarket to decide for yourself. No login, no wallet, no execution.

02 — The build

One engine, three front doors.

Live market data comes from Polymarket's public APIs and gets ranked by momentum, liquidity, uncertainty and timing. Every market gets a verdict from Jev, a calibrated decision model from TypeSafe. It answers one question: which side, if either, is underpriced? That becomes WAGER, LEAN or SKIP, with a confidence score, in about 0.3 seconds.

Claude does the language work. A deep read uses web search to ground the call in current news. A cheaper model explains in plain English why Jev said what it said. An Ask chat can search the full Polymarket universe with tools, not just the markets on the board.

The same engine is exposed as an MCP server with five tools, so Claude Desktop, Claude Code or any MCP client can ask HedgePredict for the best plays directly. On desktop it's a command center with ⌘K search; on the phone it's a Flighty-style board grouped by when markets resolve.

03 — Architecture

How the pieces connect.

Every screen goes through the same functions in lib/. The website, the chat and the MCP server can't disagree, and swapping a provider touches one file.

  1. Polymarket APIs
    Gamma markets + CLOB price history, normalized into typed data
  2. Ranking engine
    Momentum, liquidity, uncertainty, timeliness; edge + Kelly sizing
  3. Jev (TypeSafe)
    Which side is underpriced? WAGER / LEAN / SKIP, batched + cached 10 min
  4. Claude
    Opus for web-grounded deep reads, Sonnet for explainers and chat
  5. Front doors
    Web app · Ask chat with tools · MCP server (5 tools)
04 — AI concepts

What this taught me about building with AI.

MCP (Model Context Protocol)

HedgePredict is also an API that AIs can use. get_best_plays, get_jev_read, recommend_market, analyze_edge and get_market_history are thin wrappers around the app's own functions. In MCP, the tool description is the instruction manual.

Brain vs. mouth

Jev isn't an LLM. It takes structured state and returns calibrated probabilities. Claude narrates the verdict but isn't allowed to re-decide it. Splitting judgment from language keeps the numbers honest.

Tool use in chat

Ask chat has tools to search every tradable market and pull Jev's verdict, so 'any good bitcoin plays?' finds markets that aren't on the dashboard.

Cost-aware design

I measured cost per click. Jev is ~570 tokens; a web-grounded deep read is 15–25¢. Limits follow cost: 3 deep reads a day, generous limits on cheap calls, Opus only where it earns it.

Provider swaps behind one function

When Vercel's AI Gateway free tier dropped Jev, I moved to TypeSafe's SDK directly by editing only jev.ts. Every front door switched at once.

05 — What broke

The parts that didn't work the first time.

01

Jev went dark in production: 'Free tier users do not have access to this model.'

Integrations fail at the billing layer, not just in code. I dropped the middleman and called the model directly.

02

Jev worked in production but not on the preview URL.

The API key was scoped Production-only, and branch deploys count as Preview. Match env-var scope across every key.

03

After a model upgrade, the deep read started answering with no news.

The new model fired parallel web searches and used up the cap before results returned. No error was thrown; I only caught it by reading the output. Read the actual answers after every upgrade.

04

Jev said SKIP on 18 out of 18 markets.

The model was fine; my question was wrong. I'd asked 'is this the favorite?' instead of 'which side is underpriced?'. I reframed it as one choice over the sides, moved the WAGER/LEAN/SKIP rule into code, and the board came alive. How you frame the question is the integration.

05

On the phone, the details sheet opened offscreen after scrolling.

A leftover transform from a fade-in animation changed what 'fixed' anchors to. Test the deployed site, scrolled down, on a real device.

Want the full story?

Next projectMission Control →
© 2026 Guerra Digital LLC