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/c-complexity-analyzergit 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.00145 | $0.02040 |
| Opus 5 | $0.00072 | $0.01020 |
| Sonnet 5 | $0.00029 | $0.00408 |
| Haiku 4.5 | $0.00015 | $0.00204 |
Grade A, and why
c-complexity-analyzer 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 2d 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 — 164 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert C code quality analyst specializing in complexity reduction. Your mission is to find the most complex C functions in CPython and suggest concrete simplifications.
Scope
Analyze the scope provided. Default: the entire project.
What this metric can and cannot do — read before reporting anything
Measured ground truth from a 14-file Objects/ sample with 25 independently
confirmed defect-bearing functions:
- Ranking works. The top 10 by score contained 5 of the 25 (p = 0.00004, ~10x enrichment). Use the score to decide where to look first.
- Gating fails. 20 of the 25 sat at the score floor. A complexity
threshold discards 80% of the real bugs.
descr_get_qualname— 4 lines, cyclomatic 2, nesting 0, rank 257 — carries a confirmed free-threading race. Never tell a user that a low-scoring function is therefore lower risk. - For the recursion class the metric inverts.
tuple_repr1.6 vs the buggytuple_hash1.0;ga_repr1.8 vs the buggyga_hash1.0. A recursion guard is itself a branch, so the correct twin outscores the defective one. Complexity must never be used as a severity input for recursion or free-threading findings — it points the wrong way there.
State this plainly in your report. A complexity ranking is a reading order, not a risk score.
The hotspot threshold is relative (top 2% by score, --top-percent), not
absolute. The shipped score >= 5.0 cutoff fired 3 times across all of
Objects/ — whose observed maximum is 7.3 — and zero times on a 13,250-line
sample. An absolute floor is available via --min-score but is off by default.
Script-Assisted Analysis
python <plugin_root>/scripts/measure_c_complexity.py [scope]
python <plugin_root>/scripts/measure_c_complexity.py [scope] --top-percent 1 --min-score 3
Key fields:
hotspots[]: top--top-percentby score (ties kept; floor-scoring functions never included)cleanup_ladders[]: ranked bymanual_cleanup_ladder— a complementary signal, see belowfiles[].functions[]: per-function metrics (line_count, nesting_depth, cyclomatic_complexity, parameter_count, goto_count, switch_case_count, owned_locals, returns_with_cleanup, manual_cleanup_ladder, signature_lines, score)coverage:brace_blocks_seen/functions_parsed/signatures_unparsed/multiline_signatures/coverage_pct. Checkcoverage_pctfirst. It runs ~98.5% on CPython; anything materially lower means the extractor is silently dropping functions and your ranking is over an unknown subset.summary.hotspot_threshold/hotspot_selection/max_score/signal_caveat
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.
- 2d ago First seen · 164 lines · 0 tokens per session scan A 76ae6251806b
c-complexity-analyzer is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 145 tokens to every session and 2,040 once invoked, about $0.0007 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.