pmq: Instructions file for Codex

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

Written for Codex and OpenCode: the file is AGENTS.md.

This is crp4222/pmq's own configuration. It tells Codex and OpenCode how to work on pmq itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything pmq configures →

View source ↗ crp4222/pmq
Reuse

Borrowing it

Nothing to install: this file belongs to crp4222/pmq. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/crp4222/pmq/main/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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pmq AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/crp4222/pmq/agents-md"><img src="https://agentmods.dev/badge/instructions/crp4222/pmq/agents-md.svg" alt="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00689 $0.00689
Opus 5.5 $0.00276 $0.00276
Sonnet 5.5 $0.00138 $0.00138
Haiku 4.5 $0.00069 $0.00069

Measured 2mo ago against content hash 004a69eee867, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 3mo ago), licensed MIT. It adds 689 tokens to every session, about $0.0028 per session on Opus 5.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

pmq AGENTS.md compared with instructions from other repositories

pmq AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pmq AGENTS.mdcrp4222/pmqInstructions file03mo agoMITA689Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,649GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot