find_hotspots
Ranks repository files by change frequency and code complexity to identify likely bug hotspots, helping you decide what to read or debug first.
Instructions
Rank files where bugs most likely hide: change frequency (churn) x code complexity.
Use after analyze_repo to decide where to look for bugs or what to read first.
Churn = number of commits touching the file in the window (git log --numstat);
complexity = approximate McCabe cyclomatic complexity per function via ast.
Research basis: relative code churn predicts defect density (Nagappan & Ball,
ICSE 2005), and churn combined with complexity pinpoints defect-prone "hotspots"
(Tornhill, "Your Code as a Crime Scene", 2015). Test files are excluded.
Returns per file: rank, score (0..1), churn, lines_changed, complexity_total, complexity_max, the 3 most complex functions (name, line, complexity), and the git command used as evidence.
Args: repo: "owner/name" or a github.com URL. top: how many files to return (1-50). since: history window, e.g. "12 months", "6 weeks", or a date "2024-01-31".
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"repo": "<repo>"
},
"name": "find_hotspots"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | ||
| repo | Yes | ||
| since | No | 12 months |