Agentic Security: Optimizing Vulnerability Hunting
How does the Pareto principle fit into agentic security?
The Pareto Principle#
The Rule: An unequal relationship exists between inputs and outputs. For example, 20% of your effort often drives 80% of your results, or 20% of customers generate 80% of a business's sales
In 1896, an economist in Italy noticed that 20% of Italy's population owned 80% of it's land.
The pareto principle is everywhere.
You probably wear about 20% of your clothes 80% of the time.
20% of the apps on your phone take up 80% of your screen time.
Most of your text messages go to a handful of people.
A restaurant menu, a few dishes make up most of the orders.
In 2002, Steve Ballmer said their Windows Error telemetry data showed that 20% of bugs caused 80% of all crashes. 1% of bugs caused half.
Microsoft used this data to decide which fixes to prioritize.
This made me want to find an answer to the question:
How does the pareto principle fit into Agentic Security?
Agentic Security#
I've spent the past 2 years using agents to find security vulnerabilities in codebases. Starting off with RAG's, then AST code-graphs...I've built variant hunting workflows, novel agent workflows, tools to grab relevant context. When it comes to using agents to find security issues in code, I know every trick and technique to get the most bang for your buck.
But there's still an elephant in the room, every AI-native security engineer struggles to tackle
The Monolith#

Large codebases can be a problem. Monorepos are an even bigger problem.
There's context size, step limits, overall budget concerns, you name it.
How would pareto fit ino this? 80% of the security vulnerabilities are in 20% of the code.
Fine, but HOW do you find that 20%?
My git instinct said the answer had to be commit activity. I pulled out Claude and built heatmap, a tool that ranks every file using commit history, code complexity, and ownership.
The idea: generate a heatmap, take the hottest 20% of files, and backtest against findings from bug bounty reports, SAST, internal pentests and variant analysis.
Does git history predict where vulnerabilities are?#
I wasn't the first person to ask this question, but it's been a long time since someone did.
Nagappan and Ball (2005) ↗ used relative code churn to predict defect density in Windows Server 2003.
Shin et al. (2011) ↗ found that complexity, churn, and developer-activity metrics predict vulnerabilities in Firefox and RHEL.
Tackling the monolith#

This monorepo was the perfect test candidate. Hundreds of findings over years, through SAST, internal findings and an active bug bounty program with 175+ rewards.
Heatmap turns 13,000 files into 2,600.
The top 20% hottest files had 80% of the findings
The top 10% had 61%
| Files reviewed | Files with findings covered |
|---|---|
| Hottest 10% (1,308 files) | 61.5% |
| Hottest 20% (2,616 files) | 78.4% |
Figure 1
A fifth of the repo covers four fifths of the files with findings
Top: the 13,080 files heatmap ranked, hottest first. Bottom: the files with known findings, split by where in that ranking they fell. Reviewing at random, the hottest 20% would hold about 20% of them.
The lumpiness shows in the raw data too.
In the smallest tenth of files by size, 0.08% had findings. In the largest tenth, 11% did.
How AI agents can use heatmap#
Figure 4
Where the ranking plugs into the agents
The scoring workflow returns the top-N files, keyed to the commit it scored. On the right, four places the agents can use that ranking.
The obvious use is scoping recon: start the agents on the hottest files instead of letting them pick their own entry points.
When variant hunting, agents can search through the hottest files first instead of going folder by folder.
During PR reviews, a file's hottness can be a signal for how hard a model should look at a diff that touches it.
"This file is in the 99th percentile for commit count and the 95th for complexity" is a reason for an agent to look harder, and it's metadata about the codebase an agent wouldn't think of to check on it's own
Check it on public code#
You can't check the backtest, but you can check this. For a concrete example, I ran a heatmap scan of pallets/click ↗ at commit 2247b35, every file sized by its lines of code and colored by its risk score. These are its top five files:
| Rank | File | Risk | Churn | Complexity |
|---|---|---|---|---|
| 1 | src/click/core.py | 92.5 | 98.3 | 69.4 |
| 2 | src/click/types.py | 89.4 | 94.8 | 67.8 |
| 3 | src/click/termui.py | 87.0 | 90.9 | 71.1 |
| 4 | .github/workflows/tests.yaml | 82.5 | 90.6 | 50.0 |
| 5 | src/click/_termui_impl.py | 82.0 | 87.6 | 60.0 |
Each score is a percentile within the scan, so it's relative: 92.5 says core.py sits near the top of click, not that it's dangerous.
heatmap explain shows how any score was built. core.py is first because 237 commits have touched it, more than any other file in click, and it has the highest total cyclomatic complexity.
heatmap is fast, Django's 35,000 commits take about five seconds.
Try it#
heatmap scan path/to/repobash