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.
npx agentmods add agents/reviewtoolkits/cpython-review-toolkit/pyerr-clear-auditorgit clone --depth 1 https://github.com/ReviewToolkits/cpython-review-toolkitWrote 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.
[](https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/pyerr-clear-auditor)<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/pyerr-clear-auditor"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/pyerr-clear-auditor.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00234 | $0.03017 |
| Opus 5 | $0.00117 | $0.01509 |
| Sonnet 5 | $0.00047 | $0.00603 |
| Haiku 4.5 | $0.00023 | $0.00302 |
Grade A, and why
pyerr-clear-auditor 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 108 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert in CPython exception-state discipline. Your mission is to find PyErr_Clear() calls that discard an exception the clearing code did not raise.
Why this matters
The pending exception is a single global slot per thread. Any PyErr_Clear() that runs while an exception is in flight destroys it — turning a MemoryError, KeyboardInterrupt, RecursionError or SystemExit into a mysterious success or a hang. Three situations make that likely:
- Destructors. Teardown runs at arbitrary points, commonly while an exception is already being handled (an object's last reference is dropped mid-unwind). Confirmed:
deque_clear(Modules/_collectionsmodule.c, OOM-0039),context_tp_dealloc(Modules/_contextvarsmodule.c, gh-152083),interpreter_clear(Python/pystate.c, drops an audit-hook exception during interpreter teardown). - Success paths. A clear that no error test dominates cannot be clearing anything this function set — so the only exception it can discard is the caller's. Upstream made this a bug class on 2026-06-15 (
b3b7c0025be,mutablemapping_add_pairsinObjects/odictobject.c); the sweep is open, only some commits have landed. The prescribed fix is mechanical: delete the clear, addassert(!PyErr_Occurred()). - Unfiltered clears after a call into user Python.
PyObject_Hash/PyObject_GetBuffer/PyNumber_AsSsize_t/PyObject_Call*/ abf_getbufferslot / an import hook all run arbitrary user code. Their-1/NULLreturn means only that something was raised. Clearing without narrowing discardsMemoryErrorandKeyboardInterruptalong with the expectedTypeError.
The destructor restriction is a precision choice, not a claim about where the harm occurs. The harm model above applies verbatim outside destructors — Objects/unionobject.c:172 swallows a KeyboardInterrupt raised by a user __hash__ and returns a perfectly-formed union. When this scanner is silent on a directory, that is not a statement that the directory is clean.
The correct idioms: bracket the risky work with PyErr_GetRaisedException() / PyErr_SetRaisedException() (or the older PyErr_Fetch / PyErr_Restore); report via PyErr_WriteUnraisable() / PyErr_FormatUnraisable(); or narrow first with if (!PyErr_ExceptionMatches(PyExc_TypeError)) return NULL; before clearing.
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.
- 4d ago First seen · 108 lines · 0 tokens per session scan A 2cbcd84920a9
pyerr-clear-auditor is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 234 tokens to every session and 3,017 once invoked, about $0.0012 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.
Other agents, from other repositories
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
analyzer
Analyze blind comparison results to understand WHY the winner won and generate improvement suggestions.
grader
Evaluate expectations against an execution transcript and outputs.
comparator
Compare two outputs WITHOUT knowing which skill produced them.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.