pmq AGENTS.md

pmq AGENTS.md is an instructions file for Codex, OpenCode from crp4222/pmq. It costs 689 tokens per session, scanned A, original, MIT.

Project instructions for a Python library and MCP server that reads Polymarket prediction-market data and can optionally place trades.

In plain words
What is it for?
They are for reading order books, calculating fees, analyzing markets, and—only with explicit permission—executing capped live or simulated orders.
Why use it?
They separate safe market-data work from live trading and set rules for credentials, simulated trading, limits, and stale data.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/crp4222/pmq/agents-md
Clone the repo
git clone --depth 1 https://github.com/crp4222/pmq

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pmq AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/crp4222/pmq/agents-md.svg)](https://agentmods.dev/instructions/crp4222/pmq/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/crp4222/pmq/agents-md"><img src="https://agentmods.dev/badge/instructions/crp4222/pmq/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 689 This file is loaded in full into every session.
When invoked 689 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00689 $0.00689
Opus 5 $0.00345 $0.00345
Sonnet 5 $0.00138 $0.00138
Haiku 4.5 $0.00069 $0.00069

Measured 3d ago against content hash 004a69eee867, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pmq AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 52 lines

How it starts

The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Working with pmq (agent instructions)

pmq is a small Python library for Polymarket CLOB V2 with two layers, plus an MCP server (pmq-mcp) exposing both to any MCP client; its trading tools exist only when the operator sets PMQ_MCP_LIVE=1 (live) or PMQ_MCP_PAPER=1 (fills simulated against the real live books, keyless, nothing reaches the exchange, wins over live), capped per order (PMQ_MCP_MAX_USD) and per UTC day (PMQ_MCP_DAILY_USD).

Data layer (no credentials, safe anywhere)

import pmq
m = pmq.parse_market(pmq.get_market(slug))       # condition id + token ids
book = pmq.get_book(m["token_a"])                # REAL TIME, trade off this
bid, bid_sz, ask, ask_sz = pmq.best_bid_ask(book)
pmq.fee(price, shares)                            # taker $, crypto rate 0.07

Never make live decisions from get_tape (data-api): it lags matching by 1 to 3 minutes. It is for offline scoring at least 5 minutes after close.

Execution layer (needs POLY_PRIVATE_KEY; treat as production)

Rules an agent MUST follow:

  1. Default to reading data, not trading. Only place orders when the user explicitly asked for live execution in this session.
  2. Book only fill.matched_shares and fill.matched_usd. A falsy Fill means nothing happened, whatever the request was.
  3. Wrap every order in try/except OrderUncertain; on that exception call executor.reconcile(condition_id) and do not place new orders on that market until it returns.
  4. Call executor.require_collateral(stake) before a session of trading. If it reports 0 while the user says the account is funded, the signature_type is wrong: the Polymarket app's default wallet needs signature_type=3 (deposit wallet).
  5. Budget with fees: a share at price p costs p + pmq.fee(p, 1).
  6. Never print or log POLY_PRIVATE_KEY or any environment secret. Addresses and builder codes are public; keys are not.
  7. FAK buys spend dollars (buy_fak(token, price_cap, usd)), FAK sells spend shares. Amounts are rounded down internally to exchange accuracy.
  8. Builder attribution: the library defaults to the maintainer's zero-commission builder code. Respect the user's choice if they set builder_code=None or their own code; do not change it silently.
  9. Shared wallets: when several senders trade one wallet, each configures its own append-only registry (POLY_ORDER_LOG) and lists the others in POLY_FOREIGN_ORDER_LOGS (colon-separated). trades_totals() then counts only OUR orders, and reconcile() claims trades unknown to every registry (post-uncertainty recovery). Sound only if every sender keeps a registry; without POLY_ORDER_LOG behavior is unchanged.

Read the full file on GitHub · 52 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 52 lines · 689 tokens per session scan A 004a69eee867

Subscribe to this mod's changes

pmq AGENTS.md is an instructions file published in the GitHub repository crp4222/pmq (0 stars, last pushed 1mo ago), licensed MIT. It adds 689 tokens to every session, about $0.0034 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

parlay-mcp GEMINI.md

Instructions for parlay-run/parlay-mcp, covering parlay — prediction market tools, what this is, when to use which tool, venue coverage (phase 1 validated) and critical caveats.

parlay-run/parlay-mcp · 463 tokens

kalshi-trading-bot-cli AGENTS.md

Instructions for OctagonAI/kalshi-trading-bot-cli, covering repository guidelines, project structure, build, test, and development commands, coding style & conventions and llm providers.

OctagonAI/kalshi-trading-bot-cli · 1,433 tokens

polymarket-tennis CLAUDE.md

Instructions for livetennisapi/polymarket-tennis: This package is the data layer for Polymarket tennis trading: market discovery (Polymarket Gamma API, keyless), market↔live-match matching (never guesses; returns None on ambiguity), and a joined LiveMarketView of market price vs live score.

livetennisapi/polymarket-tennis · 469 tokens

polymarket-agent-mcp CLAUDE.md

Claude Code instructions for demwick/polymarket-agent-mcp, covering claude.md, build & test commands, architecture, entry point & mcp server and layers.

demwick/polymarket-agent-mcp · 974 tokens

polymarket-sports-analysis CLAUDE.md

Instructions for sarviinageelen/polymarket-sports-analysis, covering claude.md, project overview, commands, install dependencies (uses venv with python 3.12) and run tests.

sarviinageelen/polymarket-sports-analysis · 1,782 tokens

polymarket-agents CLAUDE.md

Instructions for ryan-yuuu/polymarket-agents, covering claude.md, commands, install dependencies, start the system (three separate terminals) and optional flags.

ryan-yuuu/polymarket-agents · 1,044 tokens