Volatility Engine
Detect unstable code before it breaks
The Volatility Engine scans git commits for panic keywords like fix, bug, revert, urgent, and hotfix with time-decay weighting. Recent bugs matter more for identifying fragile code.
Overview
The Volatility Engine analyzes your git history to identify files that have been involved in bug fixes, hotfixes, and urgent changes. By tracking these 'panic keywords' in commit messages, it calculates a volatility score that helps your AI understand which files are historically problematic and require extra care when modifying.
How It Works
- Commit Scanning: Scans all commits touching the target file for panic keywords in commit messages: fix, bug, revert, urgent, hotfix, broken, crash, error.
- Time-Decay Weighting: Applies exponential time decay - recent issues are weighted more heavily than older ones. A bug fixed yesterday matters more than one fixed a year ago.
- Bus Factor Analysis: Identifies how many unique contributors have modified the file. Low bus factor (1-2 contributors) indicates knowledge concentration risk.
- Volatility Score: Calculates a 0-100 volatility score based on frequency, recency, and severity of issues.
Technical Details
The engine uses `git log --format` to extract commit messages and timestamps. Each panic keyword hit is scored based on recency using an exponential decay function with a configurable half-life (default 90 days). The final score combines keyword frequency, time weighting, and contributor diversity.
Use Cases
Pre-Refactor Assessment
Before refactoring a file, check its volatility to understand historical risk and allocate appropriate review effort.
Code Review Prioritization
Focus code review effort on high-volatility files that are statistically more likely to contain bugs.
New Developer Onboarding
Help new team members understand which parts of the codebase require extra caution.
Configuration Options
| Option | Default | Description |
|---|---|---|
panicKeywords | ["fix", "bug", "revert", "urgent", "hotfix", "broken"] | Keywords to scan for in commit messages |
timeDecayDays | 90 | Half-life for time decay calculation in days |
volatilityThreshold | 50 | Score threshold to flag files as high-risk |