# Setup guide — Alert Noise Reduction Agent

## 1. Install and connect alerting

Install the agent and connect it (read) to your alerting and incident systems.

```
pipx install alert-noise-agent
alert-noise-agent connect --alerts prometheus,pagerduty --incidents pagerduty
alert-noise-agent doctor
```

## 2. Configure guardrails

The incident-linked and critical-service protections are enforced here, not by the model.

```
cp .env.example .env
ANTHROPIC_API_KEY=sk-ant-...
NEVER_SUPPRESS_IF_INCIDENT_LINKED=true
MAX_SUPPRESSION=24h     # time-box; auto-expires
MODE=advise   # advise (recommend) | act (auto-suppress proven noise)
```

## 3. Mark critical services

Alerts on these are recommendation-only — never auto-suppressed.

```
# .alerts.yml
critical_services: ["checkout", "auth", "payments", "db-primary"]
noise_threshold: { window: 30d, min_fires: 50, max_ack_rate: 0.02, incident_correlations: 0 }
suppression: { reversible: true, max_duration: 24h }
```

## 4. Backtest on alert history

Replay history to confirm it would never have suppressed an incident-linked alert.

```
alert-noise-agent backtest --range 90d --explain
# reports noise found + a hard check: suppressed-incident-linked count (must be 0)
```

## 5. Wire in (advise first)

Run scheduled analysis and post recommendations; enable auto-suppression for proven non-critical noise once backtests are clean.

```
# scheduled job -> recommendations to #sre; tuning PRs to the monitoring repo
# promote MODE=act after a clean backtest
```
