Library / Code, Git & Developer Tools
Code, Git & Developer Tools
Monitor KPI anomalies with Postgres, Slack, Gmail, GitHub and Claude
When you run it, it automates developer work with OpenRouter and Claude using GitHub, Gmail, Postgres, Slack.
What it does
# KPI Anomaly Watchdog Watches the numbers your business actually runs on, and when one of them breaks, sends a human an explanation instead of a red square. ## How it works Statistics decide whether something is an anomaly. The model only ever explains why. A Code node scores every metric against a 28-day median and median absolute deviation, adjusted for day of week, and that score is what raises the alert. The investigating agent runs afterwards, cannot change the verdict, and has no free-form SQL: five parameterised tools and nothing else. Its explanation then has to survive an evidence check. Two tool-backed findings, confidence at or above 0.6, a named cause, and zero invented metric keys. Fail any one and the alert still goes out, labelled unexplained. A model that errors out entirely does the same thing. The number was real before the model ran and it stays real afterwards. Every alert a human judges feeds Monday's precision report, which turns those judgements back into concrete threshold suggestions. ## Setup steps 1. Run sql/01-schema.sql against your Postgres 2. Insert your metrics into kpi_metrics, one row per number you care about 3. Replace ALERT_SLACK_CHANNEL and DATA_ONCALL_EMAIL in Detection Settings and Report Settings 4. Attach credentials to every node showing a warning 5. Run Collect On Demand daily for two weeks, or backfill kpi_observations, before switching detection on 6. Point your alert buttons at the Disposition Webhook. Without dispositions the Monday report has nothing to compute precision from It will be quiet for two weeks. Metrics with fewer than 14 days of history are not scored at all, and that is deliberate.
The steps
- Collect On Demand
- Collect Nightly 01:00
- Load Metric Registry
- Run Metric Query
- Build Observation
- Store Observation
- Recompute Baselines
- Summarise Baseline Coverage
- Record Baseline Run
- Only Thin Coverage
- Warn Thin History
- Detect Every Morning 07:00
- Detection Settings
- Fetch Latest Vs Baseline
58 steps in total.
Similar automations
Data Sync & ETLMonitor NASA space weather and DSN anomalies with OpenRouter and Telegram12 stepsAlerts & NotificationsDetect and investigate subscription revenue anomalies with Postgres and Claude34 stepsRAG & Knowledge BasesEmail Industrial IoT KPIs with OpenAI RAG and Redis10 stepsRAG & Knowledge BasesBuild a Production KPI Dashboard with OpenAI RAG10 steps