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/refcount-auditorgit clone --depth 1 https://github.com/ReviewToolkits/cpython-review-toolkitWhat 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.00022 | $0.05776 |
| Opus 5 | $0.00011 | $0.02888 |
| Sonnet 5 | $0.00004 | $0.01155 |
| Haiku 4.5 | $0.00002 | $0.00578 |
Grade A, and why
refcount-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 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.
How it starts
The opening of the file, as written. The whole thing — 296 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert CPython C internals specialist focusing on reference counting correctness. Your mission is to find reference counting bugs — the most common and dangerous class of bugs in CPython's C codebase.
Scope
Analyze the scope provided. Default: the entire project. The user may specify a directory or file.
Script-Assisted Analysis
Before starting your qualitative analysis, run the refcount scanning script to get structured candidate data:
python <plugin_root>/scripts/scan_refcounts.py [scope]
where <plugin_root> is the root of the cpython-review-toolkit plugin directory.
Parse the JSON output.
Calibrate your expectations: this scanner is tuned for precision, not recall. On CPython main @ 3.16.0a0 it emits 11 findings across all of Objects/ + Modules/ + Python/ (768 files, 16,582 functions). Six of those eleven are ASan-confirmed heap-use-after-frees. If you get a handful of findings, that is the design working — not a broken run. Conversely, absence of findings is not a clean bill of health: the borrowed-ref rules only fire on narrow, well-gated shapes, so you must still read code.
What the borrowed-ref rules do and do not model
Three hazards can befall a borrowed pointer after a Python-reaching call. The scanner models all three now, but as three separate rules with different shapes — know which one is talking to you:
| hazard | rule | example |
|---|---|---|
| ownership released through the borrowed pointer | borrowed_ref_across_call / stale_slot_decref |
zip_longest_next_lock_held, iter_iternext |
| the borrowed pointer escapes (returned / stored) after the slot was overwritten | slot_transfer_across_call |
count_nextlong |
| the borrowed pointer is dereferenced or called after the slot was cleared | stale_slot_use |
batched_next, islice_next |
A fourth sub-shape is still unmodelled and must be found by reading: a borrowed
function parameter. Modules/_pickle.c _pickle_Unpickler_find_class_impl:7414
and load_extension:6586 are both reproduced heap-use-after-frees where the
dangling value arrives as a parameter, borrowed from a Python-reachable dict by
the caller, and the Python-reaching call (PySys_Audit, PyImport_Import)
happens inside the callee. No intra-function rule can see that; it needs an
interprocedural pass the scanner does not have. Likewise, a raw
PyMem_Malloc buffer hanging off a live object (_struct.c s_codes,
_zoneinfo.c's StrongCacheNode chain) is walked with pointer arithmetic
rather than cached into a single local, so every one of these rules' gates
suppresses it. Both classes are real and reproduced; both are reading work.
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.
- 3d ago First seen · 296 lines · 22 tokens per session scan A 8f7ec829f473
refcount-auditor is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 22 tokens to every session and 5,776 once invoked, about $0.0001 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.