Forecasting desk pack
The forecasting desk pack (forecasting) runs on the pipeline engine. Give it a binary Polymarket market and the news you want weighed, and three forecasters estimate the chance it resolves Yes, without seeing the market’s price or each other. The desk combines them, compares the result with the market, and writes a brief. Once the market settles, Tevrin scores every forecaster, the desk and the market itself, and a calibration report shows how well the desk does over time.
The desk only reads public market data, and it never bets. There is no order, wallet, position or account code anywhere in Tevrin. The pack registers no tools and no external handlers, and no stage lists tools:. Its forecasts are paper records, not financial advice.
The pipelines
forecast
One run forecasts one market. A project can have many runs at once (concurrency: { runs: many }). A run starts by hand or from a signed webhook whose body is the forecast_request. The approval modes are advisory and autonomous (the default). The pipeline declares no gates, because nothing is acted on.
| # | Stage | Who | Reads | Writes | Checks |
|---|---|---|---|---|---|
| 1 | snapshot |
handler forecasting.market-snapshot |
forecast_request and Polymarket |
market |
needs forecast_request; the veto forecasting.market-open (O1–O3) ends the run vetoed |
| 2 | price |
handler forecasting.market-price |
Polymarket | market_price |
|
| 3 | news |
agent news-analyst |
market, forecast_request |
news_brief |
grounding rules N1–N3; up to 3 attempts, then an escalation |
| 4 | forecast |
agents forecaster-base-rate, forecaster-news, forecaster-skeptic (fan-out) |
market, news_brief |
forecast (one per forecaster) |
the schema; up to 2 attempts, then the run fails |
| 5 | combine |
handler forecasting.combine |
every forecast, market_price |
consensus |
the spread warning forecasting.spread (never fails the stage) |
| 6 | brief |
agent desk-writer |
market, market_price, news_brief, consensus |
forecast_brief |
After the run completes, the follow-up resolve (handler forecasting.resolve) checks the market once a day for up to 400 days (followups: [{ stage: resolve, every: 1d, for: 400d }]).
forecast-calibration
A summary of the desk’s track record. It starts by hand or on a schedule (for example 0 9 * * 1, every Monday at 09:00), and has no gates.
| # | Stage | Who | Reads | Writes |
|---|---|---|---|---|
| 1 | stats |
handler forecasting.calibration-stats |
the consensus of every forecast run completed in the last 400 days, with its scores |
calibration_stats |
| 2 | write |
agent calibration-writer |
calibration_stats |
calibration_report (Markdown) |
Artifacts
The JSON schemas in the pack are authoritative. Each field’s title and description label the forms in the UI. There is no project-scope artifact: everything belongs to a run. Every artifact locks automatically (auto_lock).
Input (you give this to a run)
forecast_request (Forecast request, JSON).
| Field | Required | Notes |
|---|---|---|
market |
yes | A market slug (will-it-rain-in-london-on-friday), polymarket.com/market/<m>, polymarket.com/event/<e>/<m>, or polymarket.com/event/<e> for an event with exactly one market |
news |
0–30 pasted items: { id, title?, text, publishedAt? }. Ids are n1, n2, …; each text is at most 20,000 characters |
|
notes |
Anything else the desk should know (at most 4,000 characters) |
An event with several markets is vetoed with O2: event <e> has 4 markets; give a market slug. Copy the market’s own link from the event page instead.
Outputs
| Artifact | Shape |
|---|---|
market |
{ slug, question, rules, endDate, outcomes, closed, resolution }, plus eventSlug and eventMarkets when it was found through an event. rules is Polymarket’s description text. It holds no price. |
market_price |
{ yesPrice, volume, fetchedAt }: the Yes price (0–1) when the run read it |
news_brief |
facts: [{ id, claim, newsId, quote }], keyUncertainties (1–8), baseRateHints |
forecast |
One per forecaster: probability (0.01–0.99), confidence (low, medium or high), reasoning (at most 4,000 characters), keyFactors (1–8), baseRate? |
consensus |
{ probability, spread, edge, stance, disagreement, branches: [{ agent, probability, confidence }] } |
forecast_brief |
Markdown, for you to read |
resolution |
{ resolution: yes \| no \| void }, written by the check that sees the market settle |
calibration_stats |
forecast-calibration’s stats (below) |
calibration_report |
Markdown |
The market snapshot and the veto
snapshot reads the market’s question, rules and dates from Polymarket and stores them as market. Then the forecasting.market-open veto checks it. Any finding ends the run vetoed before an agent runs:
| Rule | Vetoes when |
|---|---|
| O1 | the market is closed |
| O2 | its outcomes aren’t exactly ["Yes", "No"], or the link is an event with several markets |
| O3 | it ends within 24 hours of the run’s start, or has already ended |
A market with no end date can’t end within 24 hours, so O3 passes it (endDate is stored as null).
price then reads the Yes price into its own artifact, market_price. That’s why it’s a separate stage: the price never sits in an artifact a forecaster reads.
News grounding
The news analyst turns your pasted news into facts the forecasters may use. forecasting.news-grounding checks every fact before the brief is accepted:
- N1:
newsIdis the id of a pasted item. With no items,factsmust be empty, and the brief says that no news was given. - N2:
quoteis 10–500 characters copied from that item. Spacing, curly quotes, dashes and case don’t matter; every other character does. - N3: every number in
claimappears in itsquote.
For example, with n1 reading “Forecasters at the Met Office put the chance of rain in London on Friday at 70%, up from 40% on Monday.”, the claim “The Met Office puts the chance of rain on Friday at 75%”, quoting “put the chance of rain in London on Friday at 70%”, is rejected with N3: f1 states "75", which isn't in its quote. The findings go back to the analyst for its next attempt. After 3 failed attempts an escalation gate waits for an Owner.
The analyst never fetches anything: it reads only what you paste. Pasted news and Polymarket’s rules text are untrusted, so the prompts put them in delimited data blocks and tell every agent to treat them as data.
The three forecasters
forecast fans out to three agents, each bound under agents: with its own prompt (and model, if the project sets one):
| Agent | Approach |
|---|---|
forecaster-base-rate |
Starts from the outside view: a reference class and its base rate, then modest adjustments |
forecaster-news |
Works from the inside view: how each fact in the news brief bears on the question, and the time left |
forecaster-skeptic |
Looks for what others miss: the exact rule wording, edge cases, and why the obvious answer could be wrong |
Why they don’t see the market price. Each forecaster’s prompt holds only market (question, rules, dates) and news_brief. They never get market_price, and they never see each other’s forecasts: each branch runs in isolation, and the engine’s fan-out isolation check (FANOUT_ISOLATION_BROKEN) fails a branch whose prompt holds a sibling’s output. A forecaster that saw the price would anchor on it, and the desk’s comparison with the market would mean nothing. The desk compares with the price only afterwards, in combine.
Combine and the spread warning
forecasting.combine is deterministic. With the three probabilities in agent order (base rate, news, skeptic), in decimal arithmetic, rounding half up to 3 places:
| Field | Value |
|---|---|
probability |
the mean |
spread |
the highest minus the lowest |
edge |
probability − the market’s Yes price |
stance |
above_market at an edge of 0.05 or more, below_market at −0.05 or less, else in_line |
disagreement |
spread ≥ 0.25 |
Example: forecasts 0.62, 0.55 and 0.71, with a Yes price of 0.48, give probability 0.627, spread 0.160, edge 0.147 and above_market.
When the spread is 0.25 or more, the forecasting.spread guard adds a warning to the combine stage execution, which the timeline shows. For forecasts 0.30, 0.72 and 0.50 it’s S1: forecasters disagree by 0.42 (0.30–0.72). The warning never fails the stage: the run goes on, and the desk writer says the forecasters disagree.
Resolution and Brier scores
The run declares three outcomes, all probability_brier:
| Metric | Scores | Target |
|---|---|---|
forecasters |
each forecaster (one score per branch) | the forecast stage, path probability |
desk |
the combined forecast | the combine stage’s consensus, path probability |
market |
the market’s own Yes price, as a baseline | the price stage’s market_price, path yesPrice |
A Brier score is the squared gap between a forecast and what happened (1 for Yes, 0 for No): 0 is perfect, and always saying 50% scores 0.25. Lower is better.
The resolve check runs once a day from the day after the run completes. Each check reads the market once:
| The market | The check |
|---|---|
| open, or closed but not settled yet | answers Waiting; the next day’s check is queued |
| resolved Yes or No | records forecasters, desk and market with value 1 or 0, writes resolution, and stops |
| void (refunded, or settled at 50/50) | records nothing, writes { resolution: void }, and stops |
A vetoed run never forecast, so no checks are scheduled for it. If Polymarket can’t be read one day, that check fails and the next day’s is still due. Three failed checks in a row stop the checks (followup_failed). After 400 days without a resolution, the last check records followup_expired. Cancelling a completed run cancels its pending check. The timeline shows each check as “Check n” with the next due time.
Example: the market above resolves Yes. The forecasters score 0.1444, 0.2025 and 0.0841, the desk (0.627) scores 0.139129, and the market (0.48) scores 0.2704. The run’s Outcomes panel shows one forecasters row per forecaster, and prompt comparison shows the mean forecasters score for each forecaster key.
You can also record an outcome yourself (for example if Polymarket voids a market you want scored another way). Recording a metric again supersedes the earlier value.
Which score wins. A score you record by hand before the market settles stands: when resolve sees the market settle, it skips every metric that already has a current score, and records only the others. To have resolve’s value instead, don’t record that metric first. A score you record after the check has run supersedes the check’s.
curl -X POST "$TEVRIN/api/pipeline-runs/$RUN_ID/outcomes" \
-H 'Content-Type: application/json' \
-d '{ "metric": "desk", "value": 1, "note": "Resolved Yes" }'
The calibration report
forecasting.calibration-stats reads every forecast run completed in the last 400 days. Only runs with current scores count as resolved. Means use decimal arithmetic and round half up to 4 places.
| Field | Meaning |
|---|---|
resolved, unresolved |
how many runs have scores, and how many don’t yet |
forecasters |
per forecaster key, { n, meanBrier } |
desk, market |
{ n, meanBrier } |
skill |
1 − desk mean ÷ market mean, to 3 places: above 0, the desk beat the market’s price. null with no scores or a market mean of 0 |
buckets |
the desk’s predictions in tenths (from, to, n, meanPrediction, hitRate), leaving empty tenths out |
Example: run A (above, resolved Yes), run B (forecasts 0.20, 0.35 and 0.10, desk 0.217, market 0.30, resolved No) and run C (unresolved) give resolved 2, unresolved 1; forecasters 0.0922, 0.1625 and 0.0471; desk 0.0931; market 0.1802; skill 0.483; and two buckets, 0.6–0.7 (hit rate 1) and 0.2–0.3 (hit rate 0).
The calibration writer turns the stats into calibration_report. It reports them as given and never recomputes them.
Start a run
From the UI
- Open the project’s Pipeline tab and select Start run.
- Pick
forecast, and an approval mode. - Fill in the
forecast_requestform (the market link, and paste each news item’s text), or choose Upload a JSON file. - Select Start run.
For forecast-calibration, pick it and select Start run: it has no input.
From the API
curl -X POST "$TEVRIN/api/projects/$PID/pipeline-runs" \
-H 'Content-Type: application/json' \
-d '{ "pipelineId": "forecast", "inputs": { "forecast_request": {
"market": "https://polymarket.com/event/london-rain-friday",
"news": [ { "id": "n1", "title": "Met Office outlook", "publishedAt": "2026-11-30",
"text": "Forecasters at the Met Office put the chance of rain in London on Friday at 70%, up from 40% on Monday." } ] } } }'
Errors: 400 INPUT_INVALID (the request fails its schema, with the failing paths). A market that can’t be found, or Polymarket being unreachable, fails the snapshot stage (see below), not the request.
From a signed webhook
An Owner creates a webhook for the pipeline:
curl -X POST "$TEVRIN/api/projects/$PID/pipeline-webhooks" \
-H 'Content-Type: application/json' \
-d '{ "pipelineId": "forecast" }'
The response has url, id and secret. The secret is shown once. The body you post is the forecast_request JSON, and each call starts its own run. Sign the exact raw body: the X-Tevrin-Signature header is t=<unix seconds>,v1=<hex>, where the hex is HMAC-SHA256(secret, "<t>.<raw body>"), and send a unique X-Tevrin-Delivery UUID. The full rules are in Triggers and webhooks.
SECRET='whsec_...'
T=$(date +%s)
BODY='{"market":"will-it-rain-in-london-on-friday"}'
SIG=$(printf '%s' "$T.$BODY" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $NF}')
curl -X POST "$TEVRIN/api/hooks/pipelines/$WEBHOOK_ID" \
-H 'Content-Type: application/json' \
-H "X-Tevrin-Signature: t=$T,v1=$SIG" \
-H "X-Tevrin-Delivery: $(uuidgen)" \
--data-binary "$BODY"
A success is 202 with { runId }.
On a schedule (calibration)
curl -X POST "$TEVRIN/api/projects/$PID/pipeline-schedules" \
-H 'Content-Type: application/json' \
-d '{ "pipelineId": "forecast-calibration", "cron": "0 9 * * 1", "timezone": "Europe/London" }'
See Triggers and webhooks for the schedule rules.
The data source
Market data comes from Polymarket’s public market data API (Gamma), which needs no account or key. The host’s read-only adapter (Tevrin.Infrastructure/MarketData/Polymarket) implements the pack’s IPredictionMarketSource; the pack itself makes no network calls.
- It sends only
GETrequests, toMarketData:Polymarket:BaseUrl(defaulthttps://gamma-api.polymarket.com; setMarketData__Polymarket__BaseUrlto change it). - Each request times out after 10 seconds, and a 5xx answer or a timeout is retried twice. Answers over 2 MB are refused, and redirects aren’t followed.
- A run makes one market request in
snapshot, one inpriceand one per daily check. Nothing polls outside the checks. - Only binary Yes/No markets are forecast (O2).
When a read fails, the stage fails with a stage error code, shown in the timeline:
| Code | Meaning | What to do |
|---|---|---|
MARKET_DATA_NOT_FOUND |
The market (or event) doesn’t exist, or the link isn’t a Polymarket market or event link | Check the slug or link, and start a new run |
MARKET_DATA_UNAVAILABLE |
The adapter isn’t configured, timed out, or failed after its retries | Check MarketData:Polymarket:BaseUrl, then retry the stage |
Other venues (Kalshi, Metaculus) would be another IPredictionMarketSource adapter, with no change to the pack.
Privacy and safety
- The market’s question and rules, and your pasted news, are sent to the project’s configured LLM provider. Nothing else about you or the project is.
- Pasted news and Polymarket’s rules text are untrusted. The prompts put them in delimited data blocks and tell the agents to treat them as data. No agent has tools, so an injected instruction can’t act, and N1–N3 catch numbers it makes up.
- The desk only reads public market data. It never places a bet, and holds no wallet, keys or account. Forecasts are paper records, not financial advice.