Skip to content

Impact Analysis Tools

Impact analysis tools help agents assess what might break before making changes. They trace dependencies, score risk, identify dead code, and reveal architectural structure.

Assess the full blast radius of file changes: maps files to symbols, traces reverse dependencies, groups by cluster, and returns a risk level (Low/Medium/High) with impact scores.

Use before merging a PR. For single-symbol impact, use brain_impact. For cross-repo impact, use cross_repo_contracts.

ParameterTypeRequiredDescription
changed_filesstring[]YesList of changed file paths (repo-relative). Example: ["src/auth/login.ts", "src/utils/validate.ts"].
max_depthintegerNoMaximum transitive traversal depth. Default 3.

Trace reverse dependencies of a symbol to understand what might break if it changes. Returns confidence-weighted impact scores (0.0—1.0) decaying through the call graph.

Use before modifying a function, class, or interface. Results are sorted by impact_score (highest risk first).

ParameterTypeRequiredDescription
symbolstringYesSymbol name (e.g. "validateUser") or full UID. Names are resolved via first-match lookup.
depthintegerNoMax traversal depth. Default 3.
limitintegerNoMax impact nodes to return (default 50). Total count is always reported.
response_formatstringNo"concise" returns affected symbol names only; "detailed" (default) adds file paths, edge types, confidence scores, and depth levels.

Prioritize which test files a PR should run by mapping changed files through the call/import graph to test files. Results are bucketed into priority tiers.

ParameterTypeRequiredDescription
changed_filesstring[]NoChanged file paths (repo-relative). Example: ["src/auth/login.ts"].
base_refstringNoGit ref to diff against (e.g. "main"). Used when changed_files is omitted.

Provide either changed_files or base_ref. Tier 1 = directly references changed symbol, Tier 2 = direct caller, Tier 3 = transitive.

Find potentially unreachable symbols by walking forward from all entry points (main, HTTP handlers, event listeners, test runners).

ParameterTypeRequiredDescription
min_confidencestringNoMinimum confidence: "low" (default, show all), "medium", or "high" (strong candidates only).
response_formatstringNo"concise" returns name + confidence only; "detailed" (default) adds UIDs, file paths, kinds, and visibility.

Confidence scoring: High = private/internal symbols, Medium = inferred visibility, Low = public/library API. Public symbols flagged as Low may be consumed by external code.

Assess file-level blast radius for a set of changed files. Maps files to symbols, traces transitive dependents, and returns a risk assessment.

Use before committing or reviewing changes. For single-symbol impact, use brain_impact. For git diff details, use brain_diff.

ParameterTypeRequiredDescription
filesstring[]YesList of changed file paths (repo-relative).

Returns affected symbols, affected processes, and risk level (low, medium, high).

Identify the most connected symbols in the codebase ranked by total degree (incoming + outgoing edges). These are the architectural core.

ParameterTypeRequiredDescription
top_nintegerNoNumber of top hubs to return. Default 10.
response_formatstringNo"concise" returns name + total degree only; "detailed" (default) adds UIDs, file paths, PageRank scores, and cluster IDs.

Includes cluster membership when a clustering sidecar exists. For chokepoints between communities, use bridge_nodes instead.

Find architectural chokepoints — symbols with high betweenness centrality that sit on many shortest paths between other nodes.

ParameterTypeRequiredDescription
top_nintegerNoNumber of top bridges to return. Default 10.
response_formatstringNo"concise" returns name + betweenness score only; "detailed" (default) adds UIDs, file paths, and connected community IDs.

Betweenness is computed via Brandes’ algorithm with sampling (approximate for large graphs). For most-connected nodes by degree, use hub_nodes.

View the codebase’s high-level architecture via Leiden community detection. Groups tightly-connected symbols into named functional clusters.

ParameterTypeRequiredDescription
resolutionnumberNoLeiden resolution parameter. Higher = more, smaller clusters; lower = fewer, larger clusters. Default 0.5 (0.3 for large graphs with over 10K symbols).

Returns cluster name, cohesion score, key files, and up to 20 member symbols per cluster.

Find cross-repository references to a symbol — other repos that import, re-export, or implement the same symbol name.

ParameterTypeRequiredDescription
uidstringNoSymbol UID. Preferred for unambiguous lookup.
namestringNoSymbol name (e.g. "UserService"). Uses first match if multiple symbols share the name.
limitintegerNoMax contract links to return (default 50). Total count is always reported.

Provide either uid or name. Only useful when multiple repos are indexed in the same brain. Contract links are hypotheses — check confidence scores before acting.

Audit API contract drift: routes declared in specs (OpenAPI, .proto, GraphQL) but not implemented, and routes implemented but not declared in any spec.

ParameterTypeRequiredDescription
repostringNoOptional repo UID to scope the analysis to a single repository.
limitintegerNoMax results per drift bucket (default 50). Totals are always reported.

Returns two buckets: declared_not_implemented and implemented_not_declared. Contract links are hypotheses derived from spec parsing and handler heuristics.