The Problem

AI‑generated code often drifts after a few iterations: functions disappear, imports become stale, and quality metrics degrade without a concrete signal. Developers need a fast, language‑agnostic way to surface structural health so an agent can correct itself before the breakage reaches production.

What This Does

sentrux ships a single native binary (built from the sent‑rux‑bin crate) that scans a project with 52 tree‑sitter language plugins (see plugins/*/plugin.toml). It builds a dependency graph, computes metrics (fan‑in/out, modularity, DSM), and exposes a real‑time UI. Core analysis lives in sent‑rux‑core/src/analysis/* and the UI in sent‑rux‑core/src/app/*. The CLI entry points are sent‑rux‑bin/src/main.rs (calls run in main_impl.rs) and sent‑rux‑bin/src/lib.rs which expose the library API.

How It Is Wired

Execution starts at sent‑rux‑bin/src/main.rs:1 → main. main invokes run defined in sent‑rux‑bin/src/main_impl.rs:178. run traverses 257 functions, most of which are in the core crate:

  • insert (called from 78 places) and entry (43 places) are the primary registry mutators; they live in sent‑rux‑core/src/analysis/resolver/suffix.rs and sent‑rux‑core/src/analysis/lang_registry.rs.
  • compute_health (40 callers) aggregates metric scores in sent‑rux‑core/src/metrics/mod.rs.
  • build_graphs (33 callers) and snap_with_edges (30 callers) construct the structural graph (sent‑rux‑core/src/analysis/graph/mod.rs).

The most central module is sent‑rux‑core/src/analysis/parser/mod.rs (22 functions, referenced by 36 files). It parses source files and hands AST nodes to the resolver. The UI panels (dsm_panel.rs, metrics_panel.rs, etc.) render the graph but do not own core logic.

No circular import edges were detected, but three files (suffix.rs, main_impl.rs, metrics/mod.rs) exceed 800 lines and contain nesting depths of eight, making changes high‑risk. Duplicated 6‑line blocks appear in 18 files (e.g., test suites and panel code), inflating maintenance cost.

How To Use It

# Clone the exact repo
git clone https://github.com/moses-y/sentrux.git
cd sentrux

# Build the release binary
cargo build --release        # produces target/release/sentrux

# Run the GUI on the current directory
./target/release/sentrux

# Run a CI‑friendly check (exit code 0/1)
./target/release/sentrux check .

Configuration files live under .sentrux/ (e.g., rules.toml) and can be edited to add custom quality rules. The binary respects --mcp to expose a Model‑Context‑Protocol server, as described in the README.

Real‑World Use

A CI pipeline can invoke sentrux check . after a pull request; the exit status blocks merges when health drops. An autonomous coding agent can keep a baseline with sentrux gate --save . before a generation cycle, then call sentrux gate . after the agent finishes to detect regressions and feed the diff back into its prompting loop.

Code Health & Issues

Critical – privileged checkout of PR code in .github/workflows/ci-release.yml. High – unpinned actions (softprops/action-gh-release@v2, dtolnay/rust-toolchain@stable). High – steps discard exit codes or use continue-on-error in .github/workflows/build-grammars.yml. High – lacking least‑privilege GITHUB_TOKEN permissions. Medium – no Dependabot setup. Medium – no dependency‑vulnerability scan in CI. Medium – large binary assets (demo.gif 8.9 MiB) should be moved to LFS. Medium – checkout keeps credentials; set persist-credentials: false. Medium – test coverage low (22 test files vs. 121 source files). Medium – deep nesting (max depth 8) in suffix.rs, main_impl.rs, graph/mod.rs. Medium – duplicated 6‑line blocks across 18 files. Low – three stray TODO/FIXME markers in main_impl.rs.

The Bottom Line

sentrux provides a functional Rust‑based sensor that can feed real‑time architectural metrics into AI‑assisted development workflows. The core is well‑structured, but several large, deeply nested modules and duplicated code raise the maintenance burden, and the CI configuration contains serious security gaps. Teams comfortable with Rust and willing to tighten the CI pipelines will benefit most.