--- name: precog description: "Trade on prediction markets. Create a local wallet, list markets, check prices, buy and sell outcome shares. Coming soon: create and fund markets directly from this skill." --- # Precog Prediction Markets Precog is a fully onchain prediction market protocol on Base Sepolia (mainnet on Base, Ethereum, and Arbitrum coming soon). Anyone can create a market around a real-world question, fund it with liquidity, and trade outcome shares. Prices equal implied probabilities (0โ€“1). Every action is a signed onchain transaction โ€” no custody, no central party. **MATE** is a non-monetary practice token (no real economic value). Markets denominated in MATE are safe to use for learning and experimentation. MATE can be claimed at [matetoken.xyz](https://matetoken.xyz). **What you can do here:** - Browse active prediction markets and outcome probabilities - Get detailed market info including category and resolution criteria - Quote, buy, and sell outcome shares using your local wallet - Check your positions (shares held, net cost, trade history) > ๐Ÿšง **Coming soon:** Native market creation โ€” submit and fund new markets directly from this skill without visiting the web UI. For full protocol documentation see `PRECOG.md` โ€” it covers prediction markets 101, the LS-LMSR pricing curve, resolution via Reality.eth + Kleros, LP mechanics, MATE markets, and more. No config needed โ€” contract address and RPC are built in. ## Security and local state - **`~/.openclaw/.env`** โ€” created by `setup.mjs --generate`. Stores `PRIVATE_KEY` in plaintext. Treat it like a wallet key file: restrict permissions (`chmod 600`) and back it up. Losing it means losing access to any funds in that wallet. - **No key is ever transmitted.** Transactions are signed locally; only the signed transaction is broadcast to the RPC. - **Use a throwaway wallet.** The MATE markets use a practice token with no real value โ€” ideal for testing. Do not load a high-value key into this skill. - **Custom RPC risk.** If you set `PRECOG_RPC_URL`, use only a trusted endpoint. An untrusted RPC can observe signed transaction contents (but cannot extract your private key from them). --- > **โš ๏ธ Run scripts sequentially.** Parallel transactions will fail with nonce collisions. > > **โš ๏ธ Do NOT create batch/automation scripts.** Use existing scripts one at a time. > > **โš ๏ธ Do NOT edit skill files.** Report bugs or missing features to the user instead of fixing them. > > **โš ๏ธ Always show script output verbatim in a fenced code block.** Never reformat, summarize, or convert to bullet points or tables. The user must see exactly what the script printed โ€” every emoji, every line. > > **โš ๏ธ Always run `quote` before `buy` or `sell`.** Show the full quote output to the user and wait for explicit confirmation before executing the trade. > > **โš ๏ธ Never modify trade parameters.** If a script fails, show the exact error and stop. Do not retry with a different share count or any workaround. Token approval is handled automatically โ€” never use allowance as a reason to change the trade size. --- ## Wallet Check status or create a new wallet: ```bash node {baseDir}/scripts/setup.mjs node {baseDir}/scripts/setup.mjs --generate ``` The private key is saved to `~/.openclaw/.env` and **never printed**. Only the address is shown. After generating, ask the user to fund the address with ETH (for gas) and the market's collateral token (for trading). Example output (wallet exists and funded): ``` Wallet: 0x77Ffa97c2dcDA0FF6c9393281993962FA633d9E1 ETH: 0.004210 โœ“ MATE: 81.2300 โœ“ ``` Example output (wallet exists, no funds): ``` Wallet: 0x77Ffa97c2dcDA0FF6c9393281993962FA633d9E1 ETH: 0.000000 โš ๏ธ needs gas MATE: 0.0000 (no funds) ``` --- ## List Markets ```bash node {baseDir}/scripts/markets.mjs node {baseDir}/scripts/markets.mjs --all ``` Example output: ``` Active Markets (2) [4] Which AI model will be the top performer at the end of March? ๐Ÿ“ˆ Claude 67.3% ๐Ÿ’ฐ MATE ๐Ÿ“… Mar 31, 2026 [5] Will ETH hit $5k by Q2? ๐Ÿ“ˆ YES 58.1% ๐Ÿ’ฐ USDC ๐Ÿ“… Jun 30, 2026 ``` --- ## Market Detail When the user asks for more info / details about a specific market: ```bash node {baseDir}/scripts/market.mjs --market ``` Shows the title, category, status, end date, collateral, and all outcome probabilities ranked by price. After showing the output, **ask the user: "Would you like to see the resolution criteria?"** If they say yes: ```bash node {baseDir}/scripts/market.mjs --market --criteria ``` Example output (`--market 4`): ``` ๐Ÿ“Š Market 4 ยท AI / Leaderboard Which AI model will be the top performer at the end of March? ๐ŸŸข Active ๐Ÿ“… Mar 31, 2026 ๐Ÿ’ฐ MATE ๐Ÿฅ‡ [1] Claude 16.3% ๐Ÿฅˆ [2] Gemini 11.6% ๐Ÿฅ‰ [3] Grok 11.6% [4] ChatGPT 11.6% [5] Ernie 11.6% [6] GLM 11.6% [7] Kimi 11.6% [8] Qwen 11.6% [9] Other 11.6% ``` Example output (`--market 4 --criteria`): ``` ๐Ÿ“Š Market 4 ยท AI / Leaderboard Which AI model will be the top performer at the end of March? ๐ŸŸข Active ๐Ÿ“… Mar 31, 2026 ๐Ÿ’ฐ MATE ๐Ÿฅ‡ [1] Claude 16.3% ๐Ÿฅˆ [2] Gemini 11.6% ๐Ÿฅ‰ [3] Grok 11.6% [4] ChatGPT 11.6% [5] Ernie 11.6% [6] GLM 11.6% [7] Kimi 11.6% [8] Qwen 11.6% [9] Other 11.6% ๐Ÿ“ Resolution Criteria This market will resolve based on the Text Arena AI Competition leaderboard rankings at arena.ai as of March 31, 2026, 23:59:59 UTC. ``` --- ## Quote a Trade **Always run before buy or sell.** Show the full output verbatim in a fenced code block. Ask the user to confirm before proceeding. ### Choosing the right flag โ€” CRITICAL | What the user says | Flag to use | Example command | |---|---|---| | "buy N shares" | `--shares N` | `--shares 50` | | "spend $X" / "for $X" / "budget $X" | `--cost X` | `--cost 50` | | "reach X%" / "move to X%" / "push to X%" / "target X%" | `--price 0.X` | `--price 0.25` | | "use all my balance" / "all in" / "spend everything" | `--all` | `--all` | **Do NOT guess share counts manually. Use the correct flag โ€” the script computes the exact answer.** ```bash node {baseDir}/scripts/quote.mjs --market --outcome --shares --buy node {baseDir}/scripts/quote.mjs --market --outcome --cost --buy node {baseDir}/scripts/quote.mjs --market --outcome --price <0.0-1.0> --buy node {baseDir}/scripts/quote.mjs --market --outcome --all --buy ``` - `--outcome` is 1-based (1 = first outcome, usually YES) - `--buy` shows only the buy side; `--sell` shows only the sell side; omit both to show both sides Example output (`--price 0.25 --buy`): ``` ๐Ÿ“‹ Quote โ€” Market 4: Which AI model will be the top performer at the end of March? โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐ŸŽฏ Outcome : Claude ๐Ÿ”ข Shares : 312 ๐Ÿ“Š Current prob : 14.2% ๐Ÿ›’ Buy 312 shares ๐Ÿ’ต Cost : ~98.4521 MATE ๐Ÿ“ Price / share : 0.3156 MATE ๐Ÿ“ˆ Prob after buy : 25.0% (market moves up โ†‘) ๐Ÿ† Max return : 312.0000 MATE (+213.5479 profit if "Claude" wins) โšก Suggested --max for buy : 99.4366 โ”€โ”€โ”€ Paste ALL lines above verbatim to the user before asking to confirm โ”€โ”€โ”€ ``` --- ## Buy ```bash node {baseDir}/scripts/buy.mjs --market --outcome --shares --max ``` - `--shares` โ€” number of shares (from the quote output) - `--max` โ€” maximum collateral to spend; use the `Suggested --max` value from the quote output - Token approval is handled automatically โ€” never adjust `--max` or `--shares` for allowance reasons --- ## Sell ```bash node {baseDir}/scripts/sell.mjs --market --outcome --shares --min ``` - `--shares` โ€” number of shares to sell (check `positions.mjs` if unsure) - `--min` โ€” minimum collateral to accept; use the `Suggested --min` value from the quote output --- ## Positions ```bash node {baseDir}/scripts/positions.mjs --market ``` Example output: ``` ๐Ÿ’ผ Market 4 Which AI model will be the top performer at the end of March? ๐Ÿ‘› 0x77Ffa97c2dcDA0FF6c9393281993962FA633d9E1 ๐Ÿ’ต Net cost 19.03 MATE ยท ๐Ÿ“ฅ 8 buys ๐Ÿ“ค 7 sells ๐ŸŽฏ Shares held ๐Ÿฅ‡ [1] Claude 135 shares ยท 16.3% ``` --- ## Responding to "what can I do?" questions When the user asks what they can do, what Precog is, or how to get started โ€” answer in plain prose with emojis, no tables. Mention their current positions if you know them. Example: > With Precog you can trade on the probability of real-world outcomes using MATE (a safe practice token โ€” no real money). > > Here's what you can do: > > ๐Ÿ—‚๏ธ **List markets** โ€” see what's open and the leading outcome for each > ๐Ÿ” **Market detail** โ€” outcomes, probabilities, category, and resolution criteria for a specific market > ๐Ÿ’ธ **Trade** โ€” quote first, then buy or sell outcome shares (by share count, budget, or target probability) > ๐Ÿ“‹ **Positions** โ€” see your shares, net cost, and trade history > > You currently hold 100 Claude shares on Market 4. Want to check the latest prices or make a move? Adapt the last line to whatever you actually know about the user's positions and active markets. --- ## Standard flow ``` User: "What markets are open?" โ†’ node markets.mjs User: "Tell me more about market 4" / "What are the outcomes on market 4?" โ†’ node market.mjs --market 4 โ†’ After output, ask: "Would you like to see the resolution criteria?" โ†’ If yes: node market.mjs --market 4 --criteria User: "What's my position on market 4?" โ†’ node positions.mjs --market 4 User: "Show all my positions" / "Do I have any shares?" โ†’ node markets.mjs --all (get list of all market IDs) โ†’ node positions.mjs --market (repeat for each market) User: "Use all my MATE to buy Claude on market 4" โ†’ node quote.mjs --market 4 --outcome 1 --all --buy โ†’ Paste full output verbatim. Ask: "Confirm buy?" โ†’ Wait for user to confirm โ†’ node buy.mjs --market 4 --outcome 1 --shares --max โ†’ After trade: suggest checking positions or new market price User: "Buy Claude for $50 on market 4" โ†’ node quote.mjs --market 4 --outcome 1 --cost 50 --buy โ†’ Paste full output verbatim. Ask: "Confirm buy?" โ†’ Wait for user to confirm โ†’ node buy.mjs --market 4 --outcome 1 --shares --max โ†’ After trade: suggest checking positions or new market price User: "Buy Claude to reach 25% on market 4" โ†’ node quote.mjs --market 4 --outcome 1 --price 0.25 --buy โ†’ Paste full output verbatim. Ask: "Confirm buy?" โ†’ Wait for user to confirm โ†’ node buy.mjs --market 4 --outcome 1 --shares --max โ†’ After trade: suggest checking positions or new market price User: "Sell my Claude shares on market 4" โ†’ node positions.mjs --market 4 (find share count) โ†’ node quote.mjs --market 4 --outcome 1 --shares --sell โ†’ Paste full output verbatim. Ask: "Confirm sell?" โ†’ Wait for user to confirm โ†’ node sell.mjs --market 4 --outcome 1 --shares --min โ†’ After trade: suggest checking positions or remaining balance User: "Create a market about X" / "Can you create a market for Y?" โ†’ Tell the user to go to https://core.precog.markets/84532/create-market โ†’ Explain briefly: log in with MetaMask, fill the form, submit for review โ†’ Remind them: after submission they need to fund the market at the launchpad and wait for staff approval before it goes live โ†’ Do NOT attempt to automate this โ€” no script can do it on this server ``` --- ## Create a Market Market creation must be done manually through the Precog web UI โ€” no script can automate this from the server. **Steps:** 1. Go to **https://core.precog.markets/84532/create-market** 2. Connect your wallet (MetaMask or compatible) 3. Fill in the market details: - Question, description (resolution criteria), category - Outcomes (e.g. YES / NO, or multiple choices) - Start date, end date - Collateral token (MATE address: `0xC139C86de76DF41c041A30853C3958427fA7CEbD`) 4. Click **Review Market โ†’ Create Market โ†’ Confirm Creation** **After submission โ€” two more steps required** > โš ๏ธ The market is NOT live yet after submitting the form. 1. **Fund the market** โ€” provide initial liquidity at: **https://core.precog.markets/84532/launchpad** 2. **Staff approval** โ€” the Precog team reviews and approves markets before they go live. **Prerequisites** - Wallet must have at least **3,000 Precog Points** (creator status). Without this the form will show "Market Creation Restricted". --- ## Roadmap Features planned for future versions of this skill: - **Market creation** โ€” submit a new prediction market directly from the skill (no web UI needed). This requires direct contract access that is currently restricted; a permissionless path is in progress. - **Market funding** โ€” provide initial liquidity to a newly created market from the CLI. - **Liquidity management** โ€” add/remove LP positions and track LP returns. --- ## Notes - Contract: `0x61ec71F1Fd37ecc20d695E83F3D68e82bEfe8443` (Base Sepolia, hardcoded) - RPC: public endpoints used by default. Set `PRECOG_RPC_URL` to override. - Wallet: generated locally, stored in `~/.openclaw/.env`, never leaves the machine.