Skip to content

Add Quality Ratchet System #14

Description

@frankbria

Summary

Implement automated tracking of code quality metrics across AI conversation sessions to detect context window degradation.

Problem

As AI conversations grow longer:

  • AI takes shortcuts that initially work
  • Quality metrics gradually decline
  • Coverage drops without notice
  • Test pass rates decrease
  • "Lazy" patterns reinforce themselves

Tasks

1. Quality Tracking Script

  • Create tools/quality-ratchet.py
  • Track metrics: coverage %, test pass rate, response count
  • Store history in .claude/quality_history.json
  • Implement degradation detection algorithm

2. Metrics Collection

  • Parse pytest output for pass/fail counts
  • Extract coverage percentage from reports
  • Track conversation response count
  • Timestamp each checkpoint

3. Degradation Detection

  • Compare recent average to historical peak
  • Flag >10% coverage drop
  • Flag >10% pass rate drop
  • Recommend context reset when triggered

4. CLI Interface

  • quality-ratchet.py record --response-count N
  • quality-ratchet.py check
  • quality-ratchet.py stats
  • quality-ratchet.py reset

5. Integration

  • Add checkpoint calls to AI rules
  • Update workflow documentation
  • Create alerting for degradation
  • Add to CI/CD for trending

Algorithm

recent_avg = avg(last_3_checkpoints)
peak_quality = max(all_previous_checkpoints)

if recent_avg < peak_quality - 10%:
    alert("Quality degradation detected")
    recommend("Reset AI context")

Data Format

{
  "history": [
    {
      "timestamp": "2025-11-09T10:30:00",
      "response_count": 5,
      "test_pass_rate": 100.0,
      "coverage": 85.5
    }
  ]
}

Success Criteria

  • Automatically detects quality drops
  • Provides clear visualizations of trends
  • Recommends context resets at right time
  • Integrates smoothly with development workflow

Dependencies

Estimated Effort: 4-6 hours

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions