git-history-context

git-history-context is an agent for coding agents from ReviewToolkits/cpython-review-toolkit. It costs 199 tokens per session (1,730 once invoked), scanned A, original, MIT.

A Git-history analysis agent that shows which parts of CPython, the implementation behind Python, have had frequent bug fixes or changes.

In plain words
What is it for?
Use it early in CPython reviews to identify bug-prone files, recurring fix patterns, related modules, and incomplete code migrations.
Why use it?
It helps reviewers focus on code with a history of problems and warns when limited repository history may make the results unreliable.

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-context
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-context

README.md
[![agentmods](https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/git-history-context.svg)](https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/git-history-context)
Your own site
<a href="https://agentmods.dev/agents/reviewtoolkits/cpython-review-toolkit/git-history-context"><img src="https://agentmods.dev/badge/agents/reviewtoolkits/cpython-review-toolkit/git-history-context.svg" alt="Measured on agentmods" height="20"></a>
Per session 199 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,730 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.00199 $0.01730
Opus 5 $0.00100 $0.00865
Sonnet 5 $0.00040 $0.00346
Haiku 4.5 $0.00020 $0.00173

Measured 3d ago against content hash 96f17321b0f0, 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-context 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.

plugins/cpython-review-toolkit/agents/git-history-context.md · 83 lines

How it starts

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

You are a temporal-orientation agent. You run early in the explore pipeline (after the structural include-graph-mapper, before the safety-critical agents) so downstream agents can spend their attention on the historically-buggiest code first. You are the counterpart to git-history-analyzer, which runs last to cross-reference the other agents' findings against history — do not duplicate its fix-completeness work.

Step 0: Read the envelope's notes[] first

The script now detects the conditions that used to make its output confidently wrong and puts them in notes[]. Read that array before anything else. It surfaces:

  • is_shallow_clone: true — history truncated. STOP and report prominently: "This is a shallow clone — history analysis is truncated and unreliable. Run git fetch --unshallow for meaningful results." Then produce only a caveated, best-effort summary.
  • COMMIT CAP APPLIED — the window held more commits than --max-commits; everything you are reading is a truncated prefix.
  • SCRIPT TIMEOUT — one or more passes stopped early and their output is partial.

You no longer need to run git rev-parse --is-shallow-repository by hand; the script does it and also reports repo_total_commits / repo_first_commit_date so you can sanity-check the depth. Unknown CLI flags are now a hard error rather than a silent default, so a mistyped window flag fails loudly instead of quietly analysing 90 days.

Scope

The CPython checkout under review. Focus the watchlist on Modules/, Objects/, and Python/ (the crash-bearing C).

Script-Assisted Analysis

# CPython-scale window. --days is the lever; the full history is ~13000 days.
# The whole 9,203-commit history of Objects/ analyses in well under a minute.
python <plugin_root>/scripts/analyze_history.py <scope> --days 13000

Use its commit classification, per-file/per-function churn, bug-fix density, and co-change output. The default window is only 90 days, which on CPython yields a handful of commits and no signal — always pass --days explicitly. --max-commits defaults to 50000 and is reported in time_range; the cap firing shows up in notes[].

Read the full file on GitHub · 83 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. 3d ago First seen · 83 lines · 0 tokens per session scan A 96f17321b0f0

Subscribe to this mod's changes

git-history-context is an agent published in the GitHub repository ReviewToolkits/cpython-review-toolkit (10 stars, last pushed 1mo ago), licensed MIT. It adds 199 tokens to every session and 1,730 once invoked, about $0.0010 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.