tokensave_dsm
Design Structure Matrix in stats, clusters, or matrix form -- reveals layering violations and hidden coupling
How to use it
tokensave_dsm is exposed by the Tokensave MCP server. Add the server to your MCP client (Claude Desktop, Cursor, Windsurf and others), and the tokensave_dsm tool becomes available to the model automatically. See the full listing for setup details and every tool this server provides.
Install Tokensave
cargo install tokensave # full (50+ languages, default)Other tools in Tokensave (39)
Find test files affected by source changes
Attribute/annotation/decorator introspection -- histogram of all annotations or per-site listings with target filters
Structural code rewrite via the ast-grep CLI in --rewrite mode
Find what a function calls
Find what calls a function
Detect circular file dependencies
Semantic summary of uncommitted changes for commit message drafting
Rank functions by cyclomatic & cognitive complexity, nesting depth, Halstead metrics, maintainability index, CRAP, and safety metrics
Get relevant code context for a task -- entry points, related symbols, code snippets
Rank files by fan-in/fan-out
Find unreachable symbols (no incoming edges)
Package-manifest introspection across 17 ecosystems -- workspace summary, per-package lookup, license surface, version drift
Longest file-level dependency chains (Lakos levelization) with full chain reconstruction after Tarjan SCC cycle-breaking
Semantic context for changed files -- modified symbols, dependencies, affected tests
Companion Markdown documentation for a source file -- doc content, the files it covers, and a staleness signal
Public symbols missing documentation
List indexed project files (source and tracked artifacts) with filtering
Gini inequality coefficient for any metric (complexity, lines, fan-in/out, members) -- finds god files and uneven distribution
Find classes with too many members
Composite quality signal (0-10000) from acyclicity, depth, equality, redundancy, and modularity
Most connected symbols (highest call count)
See what's affected by changing a symbol
Module-level import dependencies, cycles, and cut simulation
Find the deepest inheritance hierarchies
Insert content before or after a unique anchor string or line number
Public API surface of a file or directory
Apply N (old, new) replacements atomically -- all-or-nothing transaction
Get details + source code for a specific symbol
Detect recursive/mutually-recursive call cycles
All references to a symbol (preview rename impact)
Find symbols by name (functions, classes, types)
Recompute and diff against the baseline -- per-dimension deltas, pass/fail, automatic cleanup
Save current health metrics as a JSON baseline for later comparison
Find symbols with similar names
Quality analysis of changed files (duplications, dead code, complexity)
Index status, statistics, tokens saved
Replace a unique oldstr with newstr; fails if 0 or >1 matches (protects against multi-edit bugs)
Risk-weighted test-gap analysis combining complexity, fan-in, coverage, and 90-day git churn into a single score
Import statements never referenced