Fix What's Broken. Prove It Worked.

Detection shows you what's slowing delivery down. Correction fixes it — safely, incrementally, with proof at every step.

$npm i @avesta-hq/correction
Works with
Claude Icon
Claude
CodexSOON
CursorSOON
See it in action

Diagnose. Fix. Verify. Repeat.

correction — claude code
prevention — avesta_read_state (MCP)
Detection says: 464 dependency inversion violationsorder-service · highest churn, lowest health
Health:2.1/10 Critical
Debt Density:78.9 pts/kLOC
Lead Time:18.7 days
Tech debt workflow — 4 gates:
plan_approved
← start
approval_testing_complete
tdd_complete
review_approved
user-service|fix/dependency-inversion|Opus 4.6 (1M context)|
2%

The Problem

Most Refactoring makes things worse.

Teams refactor without tests, fix the wrong things first, and can't prove it helped. The codebase ends up worse than before.

Refactoring without tests is flying blind

Teams refactor blind — no safety net, no characterisation tests. Every structural change risks breaking what already works.

Fixing the wrong things first

A developer spends a week on naming conventions while circular dependencies strangle lead times. Without data, teams fix what's visible, not what matters.

No proof it worked

"Tech debt sprint" proposals die in budget meetings because there's no before/after measurement. Just "trust us."

How It Works

From Diagnosis to Verified Fix

Same agent fleet as Prevention. Pointed at the problems Detection found.
$npm i @avesta-hq/prevention

The Workflow

1

Diagnose & Prioritise

Detection scores your codebase and ranks problems by impact on delivery.

2

Characterisation Tests

Safety net for existing code — no refactoring without tests.

3

TDD Refactoring Cycles

Small, tested, committed — one extraction at a time, always green.

4

Code Review Gate

Architecture boundaries, regression safety, test coverage verified.

5

Verify & Repeat

Fresh Detection diagnosis confirms the fix worked. Next priority from the list.

WHY CORRECTION

What You Get

Safety Over Speed

  • Characterisation tests before any structural change
  • Every refactoring step is a small TDD cycle, always green
  • Code review gate blocks merges that break existing behaviour

Speed comes from confidence, not shortcuts.

Direction Over Intuition

  • Detection ranks problems by impact on delivery metrics
  • Fix circular dependencies before naming conventions
  • Every fix targets the highest-impact problem first

Data decides what to fix. Not gut feel.

Proof Over Promise

  • Detection diagnoses before, Correction fixes, Detection re-scores after
  • Health scores, debt density, and DORA metrics tracked per sprint
  • Board-ready trend lines, not "trust us" arguments

Sprint by sprint. Module by module. With numbers.

THE SHIFT

What Changes When You Use Correction

Before

  • Lead time: 18.7 days
  • Change failure rate: 52%
  • Health score: 2.1 / 10
  • DORA classification: Low

With Correction

  • Lead time: 7.2 days (-61%)
  • Change failure rate: 18% (-65%)
  • Health score: 4.8 / 10 (+129%)
  • DORA classification: Medium