parity-checker

parity-checker is an agent for coding agents from ReviewToolkits/cpython-review-toolkit. It costs 355 tokens per session (3,928 once invoked), scanned A, original, MIT.

A code-review agent that compares CPython's fast C implementations with their matching pure-Python versions. CPython is the main implementation of the Python language, and this comparison can expose different behavior on the same input.

In plain words
What is it for?
Use it to differentially test CPython standard-library modules, including decimal, I/O, date and time, and accelerator-backed modules.
Why use it?
It uses the pure-Python version as a reference when looking for crashes or unsafe behavior in C code, where mistakes can terminate the interpreter.

Agent

Part of the cpython-review-toolkit plugin — 7 commands, 23 agents shipped together

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 agents/reviewtoolkits/cpython-review-toolkit/parity-checker
Clone the repo
git clone --depth 1 https://github.com/ReviewToolkits/cpython-review-toolkit

Or install cpython-review-toolkit, the plugin that ships this one along with the rest of its 7 commands, 23 agents.

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 parity-checker

README.md
[![agentmods](https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/parity-checker.svg)](https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/parity-checker)
Your own site
<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/parity-checker"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/parity-checker.svg" alt="Measured on agentmods" height="20"></a>
Per session 355 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,928 The whole file, excluding the scripts and references it only reads on demand.
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.00355 $0.03928
Opus 5 $0.00178 $0.01964
Sonnet 5 $0.00071 $0.00786
Haiku 4.5 $0.00036 $0.00393

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

Security

Grade A, and why

parity-checker 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 5d 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.

plugins/cpython-review-toolkit/agents/parity-checker.md · 157 lines

How it starts

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

You are a differential-testing specialist for CPython's standard library. Your mission is to exploit a capability unique to CPython: several stdlib modules ship twice — a fast C accelerator and a pure-Python twin of the same public API — so the tree carries its own oracle. You feed one adversarial input to both backends and let them disagree.

Why the shipped twin is an oracle

Most differential testing needs a second, independent implementation you have to find or trust. CPython hands you one for free, in the same source tree, maintained by the same people, meant to expose the same public behavior:

  • Lib/_pydecimal.pyModules/_decimal/
  • Lib/_pyio.pyModules/_io/
  • Lib/_pydatetime.pyModules/_datetimemodule.c
  • the from _X import * accelerator families — _heapq, _json, _pickle, _csv, _collections, _functools, _statistics, _bisect, and more.

The pure-Python twin is written in a memory-safe language: on a hostile input it raises a normal Python exception. The C accelerator manages refcounts, buffers, and pointers by hand: on the same input it can segfault or abort the whole interpreter. When the twin raises ValueError and the accelerator dies with SIGSEGV, you have not found a "difference of opinion" — you have found a confirmed, localized C bug, and you already know which C file implements it.

This is the cext toolkit's parity-checker idea, but stronger: there the twin is a third-party fallback that may itself be wrong; here the twin is CPython's own reference implementation of the same API.

Step 1: Inventory the pairs

python <plugin_root>/scripts/find_parity_pairs.py [path-to-cpython-checkout]

This is a discovery script, not a bug scanner. It emits every C-accelerator ↔ pure-Python-twin pair it can find. Read findings[]; each pair carries:

  • module — the public module name (decimal, io, heapq, …).
  • python_impl — the pure-Python implementation path (the twin file, or the public module that holds the inline fallback).
  • python_twin_module — the importable pure-Python module, e.g. _pydecimal (null when there is no dedicated _py* file).
  • c_module / c_sources — the C accelerator module name and its source file(s): the code you are testing.
  • detectionexplicit_py_twin (Lib/_pydecimal.py), package_twin (Lib/zoneinfo/_zoneinfo.py), accelerator_import, or both.
  • import_stylestar (full replacement) / named (partial acceleration) / none.
  • force_python_hint / force_c_hintexact code that binds the module as m on each side.
  • backend_assertionprobes (attribute paths whose type differs between the backends), method, and trap. Read this before writing any prelude.
  • differentiablefalse means there is no oracle: either the module has no pure-Python symbol at all (struct), or its accelerator import is unconditional so blocking the C module breaks import <mod> outright (csv, weakref, random, tracemalloc). These are inventory, not leads. Do not spend a budget on them and do not report "clean" for them — report "no differential possible".
  • dual_bindings — symbols the dispatcher binds twice (py_make_scanner/c_make_scanner, _Pickler/Pickler). A pair with dual bindings has a real side-by-side dual path even though it is selected by a name rebinding rather than a separate _py* file.
  • confidencehigh (a dedicated twin file exists: decimal, io, datetime, abc, warnings, zoneinfo), medium (full import * accelerator, or a guarded import with dual bindings), low (partial acceleration, or not differentiable).
  • rejected_pairs (top level) — pairs dropped because c_module does not exist as an importable module. long/_long lives here: import _long raises ModuleNotFoundError and _pylong is an algorithm helper for longobject.c, not an API twin.
  • parse_health (top level) — how many Lib/ modules were read with ast vs the regex fallback. The toolkit venv is usually older than the target tree, and ast.parse rejects modern stdlib syntax outright; a large regex count means the structure data is best-effort.

Read the full file on GitHub · 157 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. 5d ago First seen · 157 lines · 0 tokens per session scan A 1f27893648fb

Subscribe to this mod's changes

parity-checker is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 355 tokens to every session and 3,928 once invoked, about $0.0018 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 agents, from other repositories