get_risk
Modification-risk assessment for files before editing — hotspot scores, dependents, co-change partners, blast radius, recommended reviewers, test gaps, and security signals.
Before changing a file, your agent should know what it's walking
into. get_risk rolls up churn, complexity, dependents, hidden
coupling (co-changes), ownership, test coverage, and security signals
into a single per-file profile — plus an optional PR-style blast-radius
analysis when you pass a changed_files list.
When to call
- Before editing any file the agent doesn't already understand.
- PR review — pass
changed_filesto get the transitive impact surface, missing co-change partners, and recommended reviewers. - Architectural planning — surface bus-factor risks and coupling hotspots ahead of time.
Parameters
Prop
Type
Returns
targets is keyed by file path. Each entry contains:
| Field | Meaning |
|---|---|
hotspot_score | 0–1 churn percentile (higher = changed more often) |
trend | "increasing", "decreasing", or "stable" (30d vs 60d rate) |
risk_type | "churn-heavy", "bug-prone", "high-coupling", "bus-factor-risk", or "stable" |
dependents_count | Number of files importing this one |
co_change_partners | Top 5 co-changed files with date and import-link flag |
primary_owner, owner_pct | Historical owner |
recent_owner, recent_owner_pct | Active maintainer if different |
bus_factor | How many people could disappear before the file becomes unowned |
contributor_count | Total contributors |
change_pattern | "feature-active", "fix-heavy", "primarily refactored", "dependency-churn", or "mixed-activity" |
change_magnitude | lines_added_90d, lines_deleted_90d, avg_commit_size |
impact_surface | Top 3 critical modules that depend on this file (PageRank-ranked) |
test_gap | true if no test file matches the file's basename |
security_signals | kind, severity, snippet from static analysis |
risk_summary | One-line human summary |
Top-level extras:
global_hotspots— top 5 hotspot files in the repo (excluding targets).pr_blast_radius(only ifchanged_filesprovided) —direct_risks,transitive_affected,cochange_warnings,recommended_reviewers,test_gaps,overall_risk_score.
Example
get_risk(["src/auth/service.py"])
get_risk(
targets=["src/payments/api.py", "src/payments/db.py"],
changed_files=["src/payments/api.py", "src/payments/db.py"],
)Things worth knowing
- Risk type classification (priority order) —
bug-proneif ≥40% of commits are fix/patch;churn-heavyif percentile ≥ 70;bus-factor-riskifbus_factor == 1and >20 commits;high-couplingif ≥5 dependents. - Change pattern is the dominant commit category at ≥50%, else
mixed-activity. - Test gap detection looks for
test_*.py,*_test.py, or*.spec.*matching the file's basename. Test files themselves are never reported as having a test gap. - PR blast radius walks the import graph up to depth 3.
Recommended reviewers are the top-5 owners of affected files.
cochange_warningsflag missing historical co-change partners not in the PR. - Cross-repo impact (workspace mode) — co-change partners and
contract links from other repos contribute to
dependents_count.
A high hotspot_score plus bus_factor: 1 plus test_gap: true is
the danger triangle. Don't ship a refactor of that file without pulling
the primary owner into review.
search_codebase
Semantic search over the wiki — natural-language queries with vector retrieval and full-text fallback, freshness-boosted, and federated across repos in workspace mode.
get_why
Architectural-decision archaeology. Search decisions in natural language, anchor them to a file path, or pull the global decision-health dashboard. Falls back to git archaeology when no recorded decisions exist.