Sentrux measures the structural health of a codebase while coding agents edit it. It parses a project with tree-sitter, builds the dependency graph, and reduces it to a single score from 0 to 10000 that updates as files change, so architectural drift is visible during a session rather than weeks later.
The score is the geometric mean of five graph-theoretic metrics, each tied to a published method: modularity (Newman 2004 community detection), acyclicity (Tarjan strongly connected components, after Martin's Acyclic Dependencies Principle), dependency depth (Lakos levelization), complexity distribution (the Gini coefficient), and redundancy from dead or duplicate code. The project describes the geometric mean as ungameable by design, citing the Nash social welfare theorem.
It ships as a single Rust binary with no runtime dependencies and runs on macOS, Linux, and Windows. sentrux opens a live treemap with dependency edges where files glow as an agent modifies them; sentrux check . exits 0 or 1 for CI; and sentrux gate --save . followed by sentrux gate . compares a session against a saved baseline. A rules file at .sentrux/rules.toml declares constraints such as maximum cycles, coupling grade, cyclomatic complexity, and god-file bans, plus ordered layers and forbidden boundary crossings.
Language support comes from 52 tree-sitter plugins, and the binary itself carries no language knowledge: each language is a plugin.toml plus tags.scm query files, so adding one requires no Rust code. An MCP server exposes nine tools — scan, health, session_start, session_end, rescan, check_rules, evolution, dsm, and test_gaps — so an agent can read its own effect on the structure and act on it.
Features
- Single quality signal: one score from 0 to 10000 as the geometric mean of five independent graph metrics
- Five root-cause metrics: modularity, acyclicity, dependency depth, complexity equality, and redundancy
- Live treemap: an interactive map of every file and dependency edge that updates as the agent writes code
- Session gate: save a baseline before an agent session and compare afterward to catch degradation
- CI check: sentrux check . exits 0 or 1 so a rule violation can block a merge
- Rules engine: .sentrux/rules.toml declares constraints, ordered layers, and boundaries with reasons
- MCP server: nine tools including scan, session_start, session_end, check_rules, dsm, and test_gaps
- 52 languages: tree-sitter plugins covering everything from Bash and COBOL to Zig, installable and extensible without Rust code
- Single binary: pure Rust with no runtime dependencies on macOS, Linux, and Windows, with GPU backend selection for the graphical view


