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[]NoChanged file paths (repo-relative), at most 1000. Example: ["src/auth/login.ts", "src/utils/validate.ts"]. Alias: files.
repostringNoRepo name or UID that the changed paths belong to.
max_depthintegerNoMaximum transitive traversal depth, 1—15. Default 3.
limitintegerNoMax affected symbols to return, 1—1000.
include_data_edgesbooleanNoAlso follow data (access) edges. Default false.
formatstringNo"json" (default) or "sarif".

Pass changed_files or its alias files, not both with different values. A changed file that is only top-level code is reported with a changed-file-top-level-only warning, and its callees are listed apart in top_level_callees.

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, UID, path::name, Class::method or path::Class::method. Ambiguous names list candidates; pass repo or a UID.
repostringNoRepo name or UID to resolve the symbol in.
depthintegerNoMax traversal depth, 1—15. Default 3.
confidencenumberNoMinimum edge confidence, 0—1. Default 0.
min_scorenumberNoMinimum impact score, 0—1. Pruned rows are disclosed.
limitintegerNoMax impact nodes to return, 1—1000 (default 50). Total count is always reported.
response_formatstringNo"concise" returns UID, name, file path, start line, depth and impact score; "detailed" (default) adds edge types and confidence.

Dependents are returned once, as impact_nodes. A miss returns isError: true with a not_found envelope and did_you_mean suggestions.

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), at most 1000. Example: ["src/auth/login.ts"]. Alias: files.
base_refstringNoGit ref to diff against (e.g. "main"). The repository’s working tree is compared with the ref.
repostringNoRepo name or UID. With base_ref, required when more than one local repo is indexed. With changed_files, limits the selection.

Pass exactly one of changed_files (or files) and base_ref. Passing both is refused as an invalid argument. The result names the repository it diffed. Tier 1 = directly references changed symbol, Tier 2 = direct caller, Tier 3 = transitive. A test file selected only because its own top-level code calls a changed function has selected_by: "top_level_code".

Before a base_ref diff, NestWeaver checks that the repository’s Git metadata belongs to its own checkout and refuses borrowed or redirected metadata. The diff runs with the repository’s hooks, fsmonitor, filter, textconv and external-diff programs disabled.

List symbols that no entry point reaches by walking forward from all entry points (main, HTTP handlers, event listeners, test runners, and each file’s top-level <module> code). The output is a review list, never a deletion list.

ParameterTypeRequiredDescription
min_confidencestringNoMinimum confidence: "low" (default, show all), "medium", or "high" (strong candidates only).
reposstring[]NoRepo names or UIDs to scope the list to, at most 100.
limitintegerNoMax rows to return, 1—1000.
offsetintegerNoRows to skip. Default 0.
page_tokenstringNoToken from a previous page, so the next page keeps the same scope.
expected_generationintegerNoGraph generation from a previous page; a page from a changed graph is refused.
response_formatstringNo"concise" returns UID, name and confidence; "detailed" (default) adds 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.

On a graph built by an older resolver generation, dead_code refuses (refused: true, reason: "outdated_resolver") and returns the nestweaver index --repo <path> --force commands to run. coverage: "degraded" means the walk had no roots or could not read its inputs, so every row is unreachable by construction.

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
changed_filesstring[]NoChanged file paths (repo-relative), at most 1000. Alias: files.
limitintegerNoMax affected symbols and processes to return, 1—1000. Default 50.

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
limitintegerNoNumber of top hubs to return, 1—1000. Default 10. Aliases: top, top_n.
reposstring[]NoRepo names or UIDs to scope the ranking to.
response_formatstringNo"concise" returns UID, name, file path and total degree; "detailed" (default) adds 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
limitintegerNoNumber of top bridges to return, 1—1000. Default 10. Aliases: top, top_n.
reposstring[]NoRepo names or UIDs to scope the ranking to.
response_formatstringNo"concise" returns UID, name, file path and betweenness score; "detailed" (default) adds 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 Louvain-style local moving community detection. This is not the full Leiden algorithm. The entry point is still named leiden.

ParameterTypeRequiredDescription
resolutionnumberNoResolution. Higher yields more, smaller clusters. Default 0.5.
cluster_idintegerNoReturn one cluster by its numeric ID. An unknown ID is a not_found miss.
reposstring[]NoCluster only the subgraph of these repos, at most 100.
limitintegerNoMax clusters per page, 0—1000. Default 50.
membersintegerNoMember symbols per cluster, 0—200. Default 20.
cluster_offsetintegerNoCluster page offset.
member_offsetintegerNoMember page offset within a cluster (members are sorted by UID).
page_tokenstringNoToken from a previous page, so the next page keeps the same scope.
expected_generationintegerNoGraph generation from a previous page; a page from a changed graph is refused.

Returns cluster name, cohesion score, key files, and 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. Alias: symbol. Ambiguous names fail. Pass uid to pin one symbol.
name_repostringNoRepo name or UID used to disambiguate name.
repostringNoOnly return links whose other endpoint is in this repo.
limitintegerNoMax contract links to return, 1—1000 (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.