实时架构质量传感器,通过图论五维评分与 MCP 集成,为 AI 编码代理提供代码架构质量的反馈闭环。
sentrux 是一个用 Rust 编写的实时架构质量传感器,专为 AI 编码代理(Claude Code、Cursor、Windsurf 等)设计。它通过分析项目文件依赖关系,基于 modularity、acyclicity、depth、equality、redundancy 五个图论维度计算不可博弈的 0–10000 综合评分(Quality Signal),并以实时 Treemap 可视化呈现项目结构健康度。
核心能力包括:内置 9 个工具的 MCP Server 实现 AI 代理闭环集成;session_start/session_end 机制追踪单次会话质量变更;基于 .sentrux/rules.toml 的规则引擎支持循环依赖、耦合等级、圈复杂度、分层边界等约束编码;sentrux check/gate 命令适配 CI/CD 质量门禁。通过 tree-sitter 插件系统支持 52 种语言,二进制本身不含语言特定代码,自定义语言插件仅需 plugin.toml 与 tags.scm。GUI 基于 wgpu 渲染,Linux 下自适应 Vulkan/GL 后端。项目采用 MIT 许可证,同时提供基于 Ed25519 密钥验证的 Pro 商业版。
安装#
# macOS
brew install sentrux/tap/sentrux
# Linux
curl -fsSL https://raw.githubusercontent.com/sentrux/sentrux/main/install.sh | sh
# Windows
curl -L -o sentrux.exe https://github.com/sentrux/sentrux/releases/latest/download/sentrux-windows-x86_64.exe
# 从源码构建
git clone https://github.com/sentrux/sentrux.git
cd sentrux && cargo build --release
快速上手#
- 执行
sentrux /path/to/project打开 GUI 查看项目架构 Treemap 与 Quality Signal 评分。 - 在项目根目录创建
.sentrux/rules.toml定义架构约束规则。 - 运行
sentrux check .验证规则合规性。 - 运行
sentrux gate --save .保存质量基线。 - 在 MCP 客户端中配置
sentrux --mcp启用 AI 代理闭环集成。
MCP 配置(通用)#
{
"mcpServers": {
"sentrux": {
"command": "sentrux",
"args": ["--mcp"]
}
}
}
规则引擎示例(.sentrux/rules.toml)#
[constraints]
max_cycles = 0
max_coupling = "B"
max_cc = 25
no_god_files = true
[[layers]]
name = "core"
paths = ["src/core/*"]
order = 0
[[layers]]
name = "app"
paths = ["src/app/*"]
order = 2
[[boundaries]]
from = "src/app/*"
to = "src/core/internal/*"
reason = "App must not depend on core internals"
待确认信息#
- Pro 具体定价细节未公开
- 团队/公司背景不明确(4 名 contributors)
- 官网声称 36K 行 Rust 代码,未独立验证
- MCP 协议具体版本号未说明