Analysis Tools
41 codebase analyzers exposed to AI agents through the act MCP server — complexity, coupling, cycles, dead code, hotspots, structural boundaries, API surface, migration readiness, and git/runtime evolution. The agent uses these to map a codebase before refactoring or porting it. See the Feature Matrix for tier details.
Complexity
| Operation | Description | Parameters | License |
|---|---|---|---|
analyze_depth |
Compute longest transitive dependency chain per file (S4 dependency depth analysis). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Builder |
analyze_hotspots |
Rank files by composite complexity score — max cyclomatic complexity, statement count, nesting depth (H1). Test files are excluded by default (is_test_file conventions); summary.test_files_excluded discloses the count. Item-level exclusion (e.g. Rust #[cfg(test)]) is per-grammar; summary.item_level_exclusion_grammars names grammars where it was modeled. Params: none [, top_n (u32), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, top_n (u32), include (string[]), exclude (string[])] |
Engineering |
analyze_inheritance |
Detect tangled inheritance — deep hierarchies (>N levels) and diamond inheritance (H6). Params: none [, include (string[]), exclude (string[])]. | none [, include (string[]), exclude (string[])]. |
Engineering |
analyze_patterns |
Find code smells — god functions, deep nesting, high coupling, and other structural issues. Use to identify refactoring targets or assess code quality. Params: none [, tier (string), pattern (string), file (string), severity (string), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, tier (string), pattern (string), file (string), severity (string), include (string[]), exclude (string[])] |
Engineering |
Coupling & Cycles
| Operation | Description | Parameters | License |
|---|---|---|---|
analyze_chokepoints |
Find files that act as critical bottlenecks — high betweenness centrality in the dependency graph (R4). granularity="symbol" ranks individual functions over the call graph instead of files (capped, with truncation disclosure). Params: none [, granularity (string), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, granularity (string), include (string[]), exclude (string[])] |
Architecture |
analyze_coupling |
Measure coupling per file — how many files depend on it (afferent) vs how many it depends on (efferent), plus instability and abstractness scores; symbol granularity reflects call relationships (syntactic, LSP-enriched when available). Use to find the most critical/fragile files. Params: none [, granularity (string), sort (string: coupling|instability|distance|afferent|efferent, default coupling = most entangled first), threshold (f64), top_n (u32, default 200), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, granularity (string), sort (string: coupling|instability|distance|afferent|efferent, default coupling = most entangled first), threshold (f64), top_n (u32, default 200), include (string[]), exclude (string[])] |
Engineering |
analyze_cycle_risk |
Score each circular dependency cycle by its external risk surface (R6 circular risk zones analysis). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Architecture |
analyze_cycles |
Find circular dependency chains in the codebase. Use to identify import cycles that cause build issues or indicate architecture problems. Params: none [, granularity (string), max_length (u32), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, granularity (string), max_length (u32), include (string[]), exclude (string[])] |
Builder |
analyze_fan_balance |
Compute fan-in/fan-out imbalance for migration ordering guidance (M6 fan balance analysis). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Enterprise |
analyze_layers |
Detect architectural layers from directory names and find dependency direction violations (S1+S2); result carries classification_coverage and is marked unreliable below 0.5 coverage (verdicts not-modeled). Params: none [, detect_only (bool), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, detect_only (bool), include (string[]), exclude (string[])] |
Engineering |
Structure
| Operation | Description | Parameters | License |
|---|---|---|---|
analyze_clusters |
Identify tightly coupled groups of files using community detection. Use to discover natural module boundaries and understand which files change together. Clusters where a hub file glues unrelated files together are flagged via hub_collapse=true and top_hubs (named hub files); pass dampen_top_k (u32) to exclude the top-k highest-degree files from propagation and reveal genuine neighborhoods. Params: none [, granularity (string), min_size (u32), dampen_top_k (u32), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, granularity (string), min_size (u32), dampen_top_k (u32), include (string[]), exclude (string[])] |
Architecture |
analyze_cohesion |
Measure intra-module cohesion for each file — ratio of internal to total symbol edges (H2); counts call edges between symbols (syntactic, LSP-enriched when available). Also reports class-level LCOM4 (connected components of each class's method graph — methods linked by a shared field access or intra-class call) with coverage-law disclosure of which grammars were modeled. Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Architecture |
analyze_entry_points |
Detect entry points: main functions, HTTP routes, CLI commands, event listeners, test files (S5). Params: none [, include (string[]), exclude (string[])]. | none [, include (string[]), exclude (string[])]. |
Engineering |
analyze_roles |
Classify files by architectural role: entry point, routing, business logic, data access, config, test, utility, types, generated (S3). Params: none [, include (string[]), exclude (string[])]. | none [, include (string[]), exclude (string[])]. |
Engineering |
analyze_seams |
Find the natural boundaries between file clusters — the narrowest points where groups of files communicate. Use to identify where to split modules or add API boundaries. Params: none [, min_cluster_size (u32), max_seam_width (u32), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, min_cluster_size (u32), max_seam_width (u32), include (string[]), exclude (string[])] |
Engineering |
split_module |
Propose how to split a file into cohesive modules — detects symbol clusters (label propagation), scores per-cluster cohesion (compute_cohesion), runs compute_extraction on the real workspace graph to produce a file-level extraction_score, and counts boundary edges (seams). Returns a ModuleSplit with confidence_floor=Syntactic, modeled_kinds=[clusters,cohesion,extraction,seams], and proposed_modules sorted by cohesion descending. Params: file (string) | file (string, workspace-relative path) |
Architecture |
Code Health
| Operation | Description | Parameters | License |
|---|---|---|---|
analyze_api_diff |
Diff the exported/public symbol surface between merge-base(base_ref, HEAD) and the working tree: per-symbol verdict rows (breaking / possibly-breaking / additive) with both signatures where they changed — removed public symbols, gained parameters, and visibility narrowing are breaking; new exports additive. Visibility-unmodeled grammars yield unjudgeable rows naming the grammar (never silence, never guessed-private); type-level claims only where types are modeled. Params: none [, base_ref (string — omit to diff against HEAD)] | none [, base_ref (string — omit to diff against HEAD)] |
Architecture |
analyze_clones |
Detect duplicated code as clone classes — type-1 (exact) and type-2 (renamed identifiers/literals) subtree clones with member ranges, token counts, and an extract_function remediation pointer when all members sit in function bodies; type-3 (gapped) clones are not detected. Params: none [, include (string[]), exclude (string[]), min_tokens (number)]. Use include/exclude to restrict the scan scope; min_tokens overrides the minimum clone size (default 50). | none [, include (string[]), exclude (string[]), min_tokens (number)] |
Engineering |
analyze_conformance |
Evaluate the [architecture] contract in .act/config.toml against the actual import graph — deny-rule, layer-rank, and public-surface violations with the offending import's file:line, plus named cycle exemptions (suppressed but counted). Returns contract_present: false when no contract section exists. Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope. | none [, include (string[]), exclude (string[])] |
Architecture |
analyze_dead_code |
Find dead code — functions, classes, and types that are never referenced from any entry point; reachability follows call edges (syntactic, LSP-enriched when available). Use before cleanup to safely identify what can be deleted. Params: none [, entry (string[]), granularity (string), include_tests (bool), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, entry (string[]), granularity (string), include_tests (bool), include (string[]), exclude (string[])] |
Builder |
analyze_extraction |
Score clusters for service or package extraction viability (M2 extraction candidates analysis); skips hub-collapse artifact clusters (flagged by analyze_clusters). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Enterprise |
analyze_inconsistencies |
Detect inconsistent abstractions — sibling files in the same directory that diverge from the group's structural pattern (H5). Params: none [, include (string[]), exclude (string[])]. | none [, include (string[]), exclude (string[])]. |
Engineering |
analyze_interface_bloat |
Detect interface bloat — files where the public API is disproportionately large relative to implementation (H3). Params: none [, include (string[]), exclude (string[])]. | none [, include (string[]), exclude (string[])]. |
Architecture |
analyze_orphan_types |
Find type definitions used exclusively outside their defining directory (H4 orphan types analysis). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Architecture |
simulate |
Simulate structural refactors in-memory and report before/after deltas — never touches disk (simulated: true). ops is an ordered change script: move_file{from,to}, remove_edge{from,to}, split_file{file,groups:[[symbol]]}, merge_files{files,to}, delete_module{file} (the deletion test — drops the module and re-wires transitive bridges A→M→B⇒A→B). Returns cycles (resolved/introduced), coupling deltas per affected unit, chokepoint centrality changes, deletion deltas for delete_module ops (surface_consumers + surface_modeled — the load-bearing signal of external symbols calling/extending the module's own surface, plus rewired vs severed file-routing edges), and — when an [architecture] contract exists in .act/config.toml — conformance violation deltas (cleared/introduced). Params: ops (required, non-empty) [, include (string[]), exclude (string[])]. | ops (required, non-empty) [, include (string[]), exclude (string[])]. |
Architecture |
Surface & API
| Operation | Description | Parameters | License |
|---|---|---|---|
analyze_export |
Export the full semantic graph (files, symbols, dependencies) in JSON, DOT (Graphviz), or CSV format. Use for visualization or external analysis. Responses are size-bounded: large graphs return truncated:true plus next_cursor — pass it back as cursor to page through; stats always reports full node/edge counts. Params: none [, format (string), cursor (u32), max_bytes (u32, default 1000000, hard cap 4000000), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, format (string), cursor (u32), max_bytes (u32, default 1000000, hard cap 4000000), include (string[]), exclude (string[])] |
Builder |
analyze_interfaces |
Map cross-module interfaces — symbols that cross directory-module boundaries, ranked by interface width (M4). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Enterprise |
analyze_surface |
Measure API surface area — count exposed functions, types, and complexity at a module boundary. Use to assess whether an API is too large or leaky. Params: none [, boundary (string), files (string), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, boundary (string), files (string), include (string[]), exclude (string[])] |
Engineering |
analyze_type_completeness |
Analyze type boundary completeness — detect 'any' types, untyped parameters, missing return types at exported function boundaries (M7). Params: none [, include (string[]), exclude (string[])]. | none [, include (string[]), exclude (string[])]. |
Enterprise |
Migration Readiness
| Operation | Description | Parameters | License |
|---|---|---|---|
analyze_features |
Inventory language-specific AST features used in the codebase — async, generics, decorators, etc. (M3). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Enterprise |
analyze_impact |
Compute change impact — two modes. File mode (Free, default): finds all files directly and transitively depending on `target` (R1). Symbol mode (Architecture): when `symbol` is set, returns transitive callers of that function symbol — syntactic-floor analysis, LSP-enhanced when available, no LSP required. Append `::<line>` to `symbol` to disambiguate overloads (e.g. `"process::42"`). Params: target (string) [, symbol (string), max_depth (u32), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). Errors: SYMBOL_NOT_FOUND, AMBIGUOUS_SYMBOL, UNSUPPORTED_SYMBOL_KIND. | target (string) [, symbol (string), max_depth (u32), include (string[]), exclude (string[])] |
Architecture |
analyze_platform_deps |
Detect platform-specific API usage by scanning imports (M5 platform dependencies analysis). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Enterprise |
analyze_readiness |
Compute migration readiness scores per file — composite of complexity, coupling, porting blockers (M1). Params: none [, include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, include (string[]), exclude (string[])] |
Enterprise |
analyze_stability |
Compute stability index (R2) and detect stable dependency violations (R3) — flags edges where stable modules depend on unstable ones. Params: none [, index_only (bool), include (string[]), exclude (string[])]. | none [, index_only (bool), include (string[]), exclude (string[])]. |
Architecture |
analyze_test_gaps |
Detect source files with no or partial test coverage (R5). When coverage_report is supplied (lcov, JaCoCo XML, or coverage.py JSON), statuses are evidence-based (evidence: "lcov"); otherwise convention-based (evidence: "convention"). Params: none [, coverage_report (string), include (string[]), exclude (string[])]. Use include/exclude to restrict the scan scope (e.g. include=["crates"], exclude=["corpus"]). | none [, coverage_report (string), include (string[]), exclude (string[])] |
Architecture |
Evolution & Runtime
| Operation | Description | Parameters | License |
|---|---|---|---|
churn_hotspots |
Rank code by git churn — change frequency weighted by recency. Workspace mode (no `file`, Architecture) ranks symbols by score = Σ recency-decayed changes; single-file mode (`file`, Free teaser) returns that file's bare commit count. Honest degradation: grammars without symbol extraction yield file-level facts only. Params: none [, file (string), top_n (u32)=50, max_files (u32)=500] | none [, file (string), top_n (u32)=50, max_files (u32)=500]. |
Builder |
co_change_clusters |
Cluster symbols that change together across git history (co-change coupling). Returns clusters with support (shared commits) and confidence. Useful for finding hidden coupling and shotgun-surgery risk. Params: none [, min_support (u32)=3, min_confidence (f64)=0.7, max_files (u32)=500] | none [, min_support (u32)=3, min_confidence (f64)=0.7, max_files (u32)=500]. |
Architecture |
coverage_overlay |
Join line coverage onto symbols — per-symbol covered/hits, plus the count of coverage records that mapped to no symbol. Joins against the current working tree; a disclosure field flags tree-relative unmapped counts and stale-report line drift. Makes test-gap analysis concrete. Auto-detects the report format: lcov, JaCoCo XML, or coverage.py native JSON. Params: report (string, path to a coverage report) [, top_n (u32)] | report (string, path to a coverage report) [, top_n (u32)]. |
Architecture |
ownership_map |
Map code ownership from git blame — per-symbol author line shares and a bus factor (smallest author set owning >50% of lines). Low bus factor = knowledge concentration risk. Identities consolidate via .mailmap when present; otherwise fragmentation_hints disclose suspect identity pairs. Workspace-wide results are ranked lowest-bus-factor-first and capped at top_n. Params: none [, file (string), max_files (u32)=500, top_n (u32)=50] | none [, file (string), max_files (u32)=500, top_n (u32)=50]. |
Architecture |
profile_overlay |
Join a CPU/sample profile onto symbols — per-symbol self% / total% / inclusive samples, ranked hottest first, plus an unmapped-frames count. Auto-detects the report format: speedscope JSON, or pprof (gzipped protobuf). Params: report (string, path to a profile report) [, top_n (u32)] | report (string, path to a profile report) [, top_n (u32)]. |
Architecture |
trace_overlay |
Join OpenTelemetry spans onto symbols — per-symbol span count and whether the symbol lies on a trace's critical (longest-duration) path. Shows which code actually runs in production. Auto-detects the report format: OTLP/JSON or OTLP-protobuf. Params: report (string, path to an OTLP trace file) [, top_n (u32)] | report (string, path to an OTLP trace file) [, top_n (u32)]. |
Architecture |