Active development. APIs and behaviour may change. Production use at your own risk. GitHub
Mentat

Architecture

AI draft → human curate → zkTLS resolve → Solana settle.

Four responsibilities, four independent layers. An idea becomes a curated market, trades on Solana, and resolves against a cryptographic proof of a canonical source. Here is the whole path.

Topology

The system, one diagram.

  one-line idea
       │
       ▼
 ┌───────────────────────────────────────────────┐
 │  AI pipeline (DSPy, model-agnostic)            │
 │   Scout ──▶ Draft ──▶ Validator  ──▶ market JSON│
 └───────────────────────────────────────────────┘
       │  structured spec
       ▼
 ┌───────────────────────────────────────────────┐
 │  Curator Console (Vue 3 + FastAPI)             │
 │   diff · validation scores · approve / reject  │
 └───────────────────────────────────────────────┘
       │  approved spec
       ▼
 ┌────────────────────┐        ┌────────────────────┐
 │ MarketFactory      │──logs─▶│ Rust indexer       │
 │ (Anchor / Solana)  │        │ (rkyv + sled) ─▶ UI │
 └────────────────────┘        └────────────────────┘
       │  trading opens
       ▼
 ┌────────────────────┐        ┌────────────────────┐
 │ zkTLS proof service│──proof▶│ MarketSettlement   │
 │ (TLSNotary-style)  │        │ (Anchor) ─▶ payout  │
 └────────────────────┘        └────────────────────┘
       ▲
   canonical source (CoinGecko, Reuters, official API)

Draft to JSON

The pipeline produces structured specs.

The agents are DSPy programs, so the backend is a config switch. The output is canonical JSON that every indexer, UI, and integration can read.

agent pipeline · python

# Scout → Draft → Validator, model-agnostic via DSPy
import dspy

class DraftMarket(dspy.Signature):
    """Turn a one-line idea into a formal market spec."""
    idea: str = dspy.InputField()
    market_json: str = dspy.OutputField(desc="canonical Mentat market schema")

pipeline = dspy.ChainOfThought(DraftMarket)
draft = pipeline(idea="Will BTC close above $100k on 2026-05-01?")

# Validator agent re-checks the draft against the rubric
# before it is ever queued for a human curator.
print(draft.market_json)

emitted market spec · json

{
  "question": "Will BTC/USD on CoinGecko be ≥ $100,000 at 2026-05-01T00:00:00Z?",
  "type": "binary",
  "resolution_criteria": "Resolves YES if the CoinGecko simple/price endpoint returns bitcoin usd ≥ 100000 at the trigger timestamp.",
  "source_allowlist": ["api.coingecko.com/api/v3/simple/price"],
  "trigger": { "at": "2026-05-01T00:00:00Z", "condition": "price >= 100000" },
  "invalidation": "Resolves INVALID if the endpoint is unreachable for the full grace window.",
  "economics": { "quote": "USDC", "trading_fee_bps": 200, "settlement_fee_bps": 50 },
  "state": "DRAFT"
}

Every stage

From idea to payout.

  1. 01

    Scout

    Gathers context, identifies candidate canonical sources, and checks the idea against policy filters. Rejects self-harm, violence, hate, and illegal-activity templates before drafting begins.

  2. 02

    Draft

    Writes the formal market spec: question text, resolution criteria, source allowlist, trigger condition, invalidation clause, and economic parameters — as canonical JSON.

  3. 03

    Validator

    Re-checks the draft against a rubric for clarity, verifiability, and policy. Loops back to Draft until it passes, so curators see clean specs, not first drafts.

  4. 04

    Curator Console

    A human reviews the spec with a diff view, validation scores, and version history. Approve, edit, or reject. AI output is a draft, never a verdict.

  5. 05

    MarketFactory

    The approved spec deploys to the Anchor MarketFactory program on Solana. The market account stores a BLAKE2 hash of the AI rationale for on-chain auditability.

  6. 06

    Rust indexer

    A Rust event indexer (rkyv + sled) tails program logs and serves fast reads to the discovery hub and trading UI over WebSocket.

  7. 07

    zkTLS proof service

    When the outcome is knowable, a proof submitter produces a TLSNotary-style proof that the named source returned the named value, and earns a bounty for the fastest valid submission.

  8. 08

    MarketSettlement

    The Anchor MarketSettlement program verifies the proof on-chain and triggers payout. No jury vote, no optimistic dispute window for the routine case.

Want to run it yourself? The quickstart walks through self-hosting and drafting your first market. For the economic parameters at each stage, see tokenomics.

Read the real implementation.

Every layer above is in the monorepo — Vue frontend, FastAPI backend, DSPy agents, Anchor programs, Rust indexer, proof service. All MIT.