# Sprint 23: Rules Auditor + Analytics

> **Size**: M-L | **Owner**: Backend + Client | **Prerequisites**: Sprint 22
> **Phase**: 5 - Platform Evolution

---

## Validation Status (2025-12-29)

### 🚫 BLOCKED — Prerequisites Not Implemented

| Prerequisite | Status | Impact |
|--------------|--------|--------|
| Usage events (Sprint 15 / OTel) | ❌ Not implemented | Cannot aggregate usage data |
| Rules schema (Sprint 22) | ❌ Not implemented | Cannot audit rule execution |

**Action required**: Complete Sprint 15 (Usage Events) and Sprint 22 (Rules Schema) before starting.

---

## Objective

Governance and feedback loops — understand why rules fire, track usage, capture evaluations.

---

## What Already Exists

| Asset | Location | Implication |
|-------|----------|-------------|
| Usage events (Sprint 15) | ❌ Not implemented | **Prerequisite missing** |
| `SummaryModel.tokens_used` | `persistence/models/core/summary.py` | ✅ Tracking exists |
| Rules schema (Sprint 22) | ❌ Not implemented | **Prerequisite missing** |

---

## Scope

| Task | Effort |
|------|--------|
| Rules conflict detection | M |
| "Why this rule wins" explanations | M |
| Usage aggregation endpoints | M |
| Usage tab UI | M |
| Evaluations entity (thumbs) | M |
| Evaluations capture UI | S |
| Evaluations tab UI | M |

---

## Deliverables

- `src/noteflow/application/services/rules_auditor.py`
- `src/noteflow/domain/entities/evaluation.py`
- Usage aggregation RPCs
- `client/src/pages/Analytics.tsx` — Usage and Evaluations tabs

---

## Post-Sprint

- Usage alerts/budgets
- Evaluation-based ranking
- A/B testing infrastructure
