
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
Open-source Bayesian trading worker for prediction markets. Named after Thomas Bayes. v0: 2026 World Cup moneyline forecasts on Polymarket, auditable belief ledger, WorkPnP worker client, dry-run edge/Kelly intents.
An open-source Bayesian trading worker for prediction markets, named after Thomas Bayes.
v0 scope: forecast 2026 World Cup match moneyline markets on Polymarket with statistical priors (Elo → Poisson), de-vigged market prices, and a transparent blend — then keep every belief on an append-only ledger and work as a forecaster on a WorkPnP pool. Trade decisions are computed dry-run only.
Hard limits in v0 (by design, see CONTRACT_v0.md §6):
openthomas edge prints intended trades
(edge / fractional Kelly) and stops there.Most trading bots are black boxes that remember only their PnL. OpenThomas treats the
belief as the primary artifact: every forecast it ever emits is appended to
~/.openthomas/forecasts.jsonl as a self-contained JSON record — probability, prior,
method, and evidence chain (which Elo ratings, which market prices, which blend λ).
Outcomes are back-filled into a separate settlements.jsonl; the original belief is never
edited. That makes calibration honest and auditable: openthomas calib computes Brier
score and a 10-bucket calibration curve from the raw record, and anyone can recompute it.
The same Forecast JSON (openthomas/forecast@0.1, frozen in CONTRACT_v0.md §1.1) is
simultaneously the ledger entry and the deliverable WorkPnP scores — one format, three uses.
data/elo-snapshot.json).
Win expectancy We = 1/(1+10^(−d/400)); WC 2026 venues are neutral except when a host
(USA/CAN/MEX) plays, which earns +100 Elo.We maps to an expected goal difference (We=0.76 ≈ +1 goal), split
around a 2.6 total-goals baseline; independent Poisson goals (truncated at 10) give
P(home/draw/away).p = (1−λ)·model + λ·market, λ = MARKET_BLEND (default 0.3). See the
comment in src/core/blend.ts for why copying the market is safe but worthless.npm install
npm run build
npm link # optional: puts `openthomas` on your PATH
# What's playing, and what does the market think?
openthomas scan
# Full pipeline for one match → three Forecast JSONs + ledger write
openthomas forecast fifwc-usa-par-2026-06-12
# Dry-run trade intents from your ledgered forecasts vs current prices
openthomas edge
# Calibration: first backfill resolutions from Gamma, then report
openthomas calib settle-sync
openthomas calib
(Or run from source without building: npm run dev -- scan.)
WorkPnP is the research-syndicate side: sponsors fund pools of forecast work; workers submit probabilities and get paid wages per accepted submission plus a profit-linked bonus.
export WORKPNP_URL=http://localhost:8787
# 1. Register (the apiKey is shown exactly once — the server stores a hash)
openthomas register --name thomas --wallet 0xYourPayoutAddress
export WORKPNP_API_KEY=<the printed key>
# 2. Work: poll open forecast work, forecast each market, submit, ledger
openthomas work # one pass
openthomas work --loop --interval 600 # keep polling
Already-submitted work items are tracked in ~/.openthomas/state.json and skipped.
| Variable | Default | Meaning |
|---|---|---|
WORKPNP_URL | http://localhost:8787 | WorkPnP server |
WORKPNP_API_KEY | — | worker key from openthomas register |
MARKET_BLEND | 0.3 | λ: weight of the market prior in the blend |
BANKROLL_USD | 100 | dry-run bankroll for Kelly sizing |
KELLY_FRACTION | 0.25 | fraction of full Kelly |
EDGE_THRESHOLD | 0.03 | minimum net edge to emit a TradeIntent |
LEDGER_DIR | ~/.openthomas | belief-ledger directory |
Agent-only (the agent command):
| Variable | Default | Meaning |
|---|---|---|
ANTHROPIC_API_KEY | — | Claude API key (or run ant auth login) — required by agent |
OPENTHOMAS_MODEL | claude-opus-4-8 | model for the agent loop |
OPENTHOMAS_ARMED | unset | set to 1 and provide a key to allow real orders; otherwise dry-run |
POLYMARKET_PRIVATE_KEY | — | EOA key for signing CLOB orders (only read when arming) |
POLYMARKET_FUNDER_ADDRESS | — | proxy/Safe address holding funds, if the key is a proxy signer |
POLYMARKET_SIGNATURE_TYPE | 0 | 0 EOA · 1 POLY_PROXY · 2 POLY_GNOSIS_SAFE |
POLYMARKET_CLOB_HOST | https://clob.polymarket.com | CLOB REST host |
POLYGON_RPC_URL | viem default | Polygon RPC |
MAX_ORDER_USD | 25 | hard cap on one order's notional |
MAX_TOTAL_EXPOSURE_USD | 100 | hard cap on total open exposure per session |
Beyond the deterministic pipeline, openthomas agent runs a specialized prediction-market
trading agent — a Claude tool-use loop that orchestrates the v0 math instead of replacing it.
It is vertically scoped on purpose: no shell, no browser, no arbitrary file access — only
trading-domain tools.
export ANTHROPIC_API_KEY=...
openthomas agent "Forecast today's World Cup matches, recall my track record, and show any edge — dry run"
Three ideas make it a forecaster's agent rather than a generic one:
ledger_recall returns prior beliefs joined with how they
resolved (calibration-aware recall), so the agent always decides while looking at its own
scored history — not a pile of un-graded notes.market_scan / market_get (Gamma), model_forecast
(Elo→Poisson + blend), edge_kelly, ledger_recall / ledger_append, calibration_report,
skill_view, and the gated place_order.skills/) — de-vig method choice,
evidence discipline, Kelly & risk — loaded on demand via skill_view.Execution safety. place_order is dry-run by default: it prints the intended order and
stops. Real orders require OPENTHOMAS_ARMED=1 plus a key, must clear the pre-trade risk gate
(per-order / per-market / total-exposure caps), and must carry confirm: true. Real signing uses
the official @polymarket/clob-client. Every intent and fill is appended to orders.jsonl.
src/core/gamma.ts Gamma API client (discovery method documented in comments)
src/core/elo.ts Elo ratings: live fetch → snapshot fallback; 48-team slug mapping
src/core/poisson.ts Elo → expected goals → Poisson → outcome probabilities
src/core/devig.ts market mids → implied probabilities
src/core/blend.ts model/market blend (λ)
src/core/pipeline.ts match → three contract-valid Forecast JSONs
src/core/ledger.ts append-only forecasts.jsonl / settlements.jsonl + calibration
src/core/decision.ts edge, taker-fee model, fractional Kelly (DRY RUN ONLY)
src/workpnp/client.ts WorkPnP worker API client (contract §2)
src/config/config.ts agent config: Kelly knobs, risk caps, the execution gate
src/agent/ tool registry, model client, agentic loop, system prompt, skills loader
src/tools/ agent tools: market, quant, ledger, risk, execute (gated orders)
skills/ human-authored methodology (SKILL.md), loaded on demand
src/cli.ts commander CLI (`openthomas`, incl. `agent`)
data/elo-snapshot.json frozen eloratings.net snapshot (see its sourcedAt field)
npm test # vitest (54 tests)
npm run typecheck # tsc --noEmit
npm run build # tsc → dist/
bun run src/cli.ts agent "..." # run the agent from source
MIT © 2026
FAQs
Open-source Bayesian trading worker for prediction markets. Named after Thomas Bayes. v0: 2026 World Cup moneyline forecasts on Polymarket, auditable belief ledger, WorkPnP worker client, dry-run edge/Kelly intents.
The npm package openthomas receives a total of 132 weekly downloads. As such, openthomas popularity was classified as not popular.
We found that openthomas demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.