git-history-analyzer

git-history-analyzer is an agent for coding agents from ReviewToolkits/cpython-review-toolkit. It costs 361 tokens per session (4,461 once invoked), scanned A, original, MIT.

A Git-history analysis agent for CPython's C code that searches past changes for related bugs, risky areas, and unfinished migrations.

In plain words
What is it for?
Use it to find similar unfixed bugs, compare related module families, rank files by change activity, and check migrations such as Argument Clinic or newer C APIs.
Why use it?
A fix in one file may reveal the same mistake elsewhere, while frequently changed code may deserve closer review.

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/git-history-analyzer
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 git-history-analyzer

README.md
[![agentmods](https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/git-history-analyzer.svg)](https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/git-history-analyzer)
Your own site
<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/git-history-analyzer"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/git-history-analyzer.svg" alt="Measured on agentmods" height="20"></a>
Per session 361 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,461 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.00361 $0.04461
Opus 5 $0.00180 $0.02230
Sonnet 5 $0.00072 $0.00892
Haiku 4.5 $0.00036 $0.00446

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

Security

Grade A, and why

git-history-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 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.

plugins/cpython-review-toolkit/agents/git-history-analyzer.md · 279 lines

How it starts

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

You are a temporal analysis specialist for the CPython C codebase. Your primary mission is to use git history to find similar bugs elsewhere in the code — the highest-value capability of this agent. Secondary goals are producing a churn-risk matrix and detecting incomplete CPython-specific migrations.

Key Concepts

Git history analysis for CPython provides unique insights:

  • Similar bug detection: When a bug is fixed, the same pattern often exists elsewhere. By analyzing fix commits, you can find unfixed instances of the same bug class across CPython's ~2000 C files.
  • Module family propagation: CPython has families of related modules (hash types, dbm types, I/O types) that share patterns. A fix in one family member should be checked against all siblings.
  • Churn analysis: Files and functions that change frequently are more likely to contain bugs and benefit most from cleanup.
  • Migration completeness: CPython has ongoing migrations (Argument Clinic, PyModule_AddObjectRef, stable ABI) that may be partially complete.

Analysis Phases

Phase 1: Run the History Analyzer

Run the analysis script:

CRITICAL — multiple agents may run this script concurrently. You MUST:

  1. Never write output to a shared filename. Always include a unique suffix derived from your date range or scope, e.g., /tmp/cpython_history_2025-03_2025-09_$$.json. Never use bare /tmp/cpython_analysis.json.
  2. Set a long Bash timeout (timeout: 300000, i.e., 5 minutes). The default 120s WILL kill the script on large repos.
  3. If the script times out, do NOT retry. Fall back immediately to manual git log + git show commands.
# Short analysis (last 100 commits) — pipe directly, no temp file needed:
python <plugin_root>/scripts/analyze_history.py <target_directory> --last 100

# Fix-completeness analysis needs a LONG window. --days is the lever; CPython's
# C history goes back to 1990 (~13000 days). The full 9,203-commit history of
# Objects/ analyses in well under a minute.
python <plugin_root>/scripts/analyze_history.py <target_directory> \
    --days 13000 --no-function > /tmp/cpython_history_MYRANGE_$$.json

Read the full file on GitHub · 279 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. 4d ago First seen · 279 lines · 0 tokens per session scan A a340618073fe

Subscribe to this mod's changes

git-history-analyzer is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 361 tokens to every session and 4,461 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.