Sentrux: The Missing Feedback Loop for AI Coding Agents

By Prahlad Menon 2 min read

There’s a pattern every developer using AI coding agents eventually hits.

Day one is great. The agent understands the project, writes clean code, ships features fast. A week later something shifts. The agent puts new code in the wrong place. It hallucinates functions that don’t exist. It breaks things it touched yesterday. You’re spending more time fixing the agent’s output than writing it yourself.

Everyone assumes the AI got worse. It didn’t. Your codebase did.

When the project was small, the agent had a complete mental map. As it grew, that map became incomplete. The agent can no longer see where things belong — so it duplicates logic, adds coupling it can’t detect, creates inconsistencies across files it hasn’t read in a while. It’s not a model failure. It’s a feedback loop failure.

Sentrux is a sensor designed to close that loop.

What It Is

Sentrux is a real-time architectural analyzer written in pure Rust. Single binary, no runtime dependencies, 52 languages via tree-sitter plugins. It does two things:

  1. Measures structural health — complexity, coupling, cohesion, duplication — and produces a quality score with a live visual treemap of your project
  2. Exposes that signal to AI agents via MCP — so the agent can query quality scores, gate against degradation, and iterate on its own output

The loop it enables: agent writes code → Sentrux scores → agent sees the score → agent improves → rescan → better score → repeat.

# Install
brew install sentrux/tap/sentrux          # macOS
curl -fsSL .../install.sh | sh            # Linux

# Open GUI — live treemap of your project
sentrux

# CI-friendly check (exits 0 or 1)
sentrux check .

# Save baseline before an agent session
sentrux gate --save .

# Compare after — catches any degradation
sentrux gate .

The Problem It’s Actually Solving

We wrote about this problem previously through a different lens — context rot and tools like GSD, BMAD, and Taskmaster that try to manage agent degradation by structuring the workflow.

Those approaches are workarounds: reset context regularly, break work into phases, use handoff documents. They reduce the problem by limiting how much the agent can accumulate.

Sentrux takes a different approach. Instead of managing the context window, it gives the agent an external source of truth about the codebase’s health. The agent doesn’t need a perfect mental map if it has a real-time quality signal to measure against.

The key distinction from context rot solutions:

ApproachStrategyMechanism
GSD/BMAD/TaskmasterPrevent accumulationReset context, structure phases
SentruxDetect and correct degradationExternal quality sensor + feedback loop

These aren’t mutually exclusive. You can use Sentrux alongside structured workflows — the gate command is particularly useful as a phase-end check.

Comparison With Karpathy’s Autoresearch / AgentHub

The question that comes up: how does this compare to Karpathy’s AgentHub and autoresearch?

They’re solving different problems at different scales:

Karpathy’s autoresearch/AgentHub — multi-agent swarms running ML experiments in parallel, coordinating via a DAG commit model. The problem: how do many agents collaborate without stomping on each other’s work. Scale: research pipelines, experiment coordination.

Sentrux — a quality sensor for a single coding agent’s output in a growing codebase. The problem: why does one agent degrade over a long session, and how can it self-correct. Scale: individual development sessions.

AgentHub is about swarm orchestration. Sentrux is about feedback loop quality for individual agents. Both address the fact that AI agents lack visibility — AgentHub into what other agents are doing, Sentrux into what their code is doing to the project’s health.

MCP Integration

The MCP integration is what makes Sentrux more than a monitoring tool. When connected to Claude Code, Cursor, Windsurf, or any MCP-compatible agent:

{
  "mcpServers": {
    "sentrux": {
      "command": "sentrux",
      "args": ["--mcp"]
    }
  }
}

For Claude Code specifically:

/plugin marketplace add sentrux/sentrux
/plugin install sentrux

The agent gains access to Sentrux as a set of tools it can call directly:

  • Query current quality score before and after changes
  • Get a structural breakdown of which files are contributing most to complexity
  • Compare against a saved baseline
  • Gate its own output — refuse to submit changes that degrade quality below a threshold

This is the self-improvement loop: the agent uses Sentrux the same way a developer would use cargo clippy or eslint — as a continuous quality signal during development, not just a one-shot check at the end.

The Rules Engine

Sentrux includes a configurable rules engine for enforcing architectural constraints. You can define rules like maximum cyclomatic complexity per function, maximum coupling between modules, or maximum file length — and sentrux check will exit with code 1 if any rule is violated.

This is useful both for CI/CD gates (block PRs that degrade quality) and for giving agents explicit constraints: “don’t add a function longer than 50 lines” is something an agent can check in real time rather than relying on a human reviewer to catch it in code review.

Where It Fits

Sentrux is most useful in sessions where:

  • The codebase is growing rapidly (agent-generated code compounds quickly)
  • You’re using a capable coding agent (Claude Code, Cursor, Codex) for extended sessions
  • You care about long-term maintainability, not just “does it work today”
  • You have CI/CD and want to gate merges on quality, not just tests

It’s less useful for short one-off tasks or greenfield prototypes where you’re moving fast and structure doesn’t matter yet.

The demo in the README is worth looking at: Claude Code Opus 4.6 building a FastAPI project with good prompts — quality score lands at 6772 without Sentrux, then improves measurably in subsequent iterations once the agent has the quality signal to act on.


Links: