:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): add insight-alerts scout (#66966)
Andrew Maguire5deb3db1eb9d
diff --git a/products/signals/skills/AGENTS.md b/products/signals/skills/AGENTS.mdindex 0c2afa469a59..6c0ef64c7f2c 100644--- a/products/signals/skills/AGENTS.md+++ b/products/signals/skills/AGENTS.md@@ -121,6 +121,19 @@ agent-enabled team's `LLMSkill` rows by `scout_harness/lazy_seed.py` — see- `signals-scout-observability-gaps/` — the odd one out. Watches for _structuralgaps_ between events being captured and existing insight / dashboard / alertcoverage, and emits P3 _recommendations_ rather than P0–P2 _anomalies_.+- `signals-scout-insight-alerts/` — digest + triage layer over the team's own+ configured insight alerts (threshold / detector alerts on insights). Doesn't+ re-detect anomalies — the user already set the thresholds — it reads each alert's+ recent firing history (`alerts-list` to triage all alerts cheaply, `alert-get` to+ deep-read the firing checks of the few candidates) and surfaces the recent firings a+ human most likely missed. Its discriminator is missed-ness × materiality ×+ persistence, weighting hardest toward firings the standard notification path stayed+ silent on (no subscribers, suppressed by the investigation agent, or an alert+ silently Errored and no longer evaluating); skips snoozed / disabled / flapping /+ already-notified-and-resolved. Complements `observability-gaps` (which recommends+ _creating_ alerts) and `anomaly-detection` (which scores insights the team _views_,+ whether or not they're alerted) — this one owns the firings of alerts that already+ exist.- `signals-scout-csp-violations/` — anomaly watcher for Content Security Policyviolations (`$csp_violation` blocked-URL clusters, per-directive bursts,post-deploy page-scoped regressions, suspicious third-party domains).diff --git a/products/signals/skills/signals-scout-insight-alerts/SKILL.md b/products/signals/skills/signals-scout-insight-alerts/SKILL.mdnew file mode 100644index 000000000000..5b86d2a969e1--- /dev/null+++ b/products/signals/skills/signals-scout-insight-alerts/SKILL.md@@ -0,0 +1,202 @@+---+name: signals-scout-insight-alerts+description: >+ Digest + triage scout over a PostHog project's own configured insight alerts. The team+ already declared what matters by creating alerts with thresholds or anomaly detectors, so+ this scout doesn't detect anomalies — it reads each alert's recent firing history and+ surfaces the handful of recent firings a human likely missed, weighting hardest toward+ firings the standard notification path stayed silent on (no subscribers, suppressed by the+ investigation agent, or an alert that's silently Errored and no longer evaluating). Skips+ snoozed, disabled, flapping, and already-notified-and-resolved alerts. Emits a finding only+ when a firing clears the confidence bar; otherwise writes durable memory and closes out+ empty. Self-contained peer in the signals-scout-* fleet.+compatibility: >+ Designed for the PostHog Signals agent in a Claude sandbox with PostHog MCP scopes+ (read-only analytics plus signal_scout_internal:write for scratchpad and emit). Assumes the+ signals-scout MCP family (project-profile-get, runs-list, runs-retrieve, scratchpad-search,+ scratchpad-remember, scratchpad-forget, emit-signal) plus the alert tools (alerts-list,+ alert-get), insight-get, and inbox-reports-list.+metadata:+ owner_team: signals+ scope: insight_alerts+---++# Signals scout: configured insight-alert firings++You are a focused digest-and-triage scout over the project's **own configured insight+alerts** (the threshold and anomaly-detector alerts users set on insights). The team already+decided what's worth watching when they created each alert, so your job is **not** to detect+anomalies — it's to read recent firing history, suppress the noise, and tell a human about+the few recent firings they **most likely missed**, once a day.++**The discriminator.** A finding is a _recent firing the team likely missed_. Because the+user set the threshold themselves, a firing is presumptively meaningful — you triage, you+don't re-detect. Rank each recent firing by **missed-ness × materiality × persistence**:++- **Missed-ness** — _did anyone actually get told?_ A firing with no `notification_sent_at`,+ empty `targets_notified`, or no subscribed users, and a firing where+ `notification_suppressed_by_agent` is true (the investigation agent swallowed it — could be+ a false negative), are the **highest-value** signals: the normal alert pipeline stayed+ silent. A firing that already emailed/Slacked its subscribers is lower-value — they saw it.+ This is the whole reason you exist: **you catch what the notification path didn't.**+- **Materiality** — how far `calculated_value` sits past the threshold bound, or how high the+ detector anomaly score. A 3× breach beats a marginal one sitting right on the bound.+- **Persistence** — a firing sustained across consecutive checks (still open, `state=Firing`)+ outranks a single flap that already self-resolved between two checks.++Internalize that ordering; it's the whole game. An alert that's silently **Errored** (no+longer evaluating) is a blind spot worth a low-severity callout, but it is _not_ a firing.++## Quick close-out: are there even alerts firing?++Cheap read first: `alerts-list`. If the project has **zero enabled alerts**, write one+`not-in-use:insight_alerts:team{team_id}` entry and close out empty. If every enabled alert is+`Not firing`, nothing was `last_notified_at` inside your window, and no alert is `Errored`,+write/refresh `pattern:insight_alerts:baseline-team{team_id}` and close out — the configured+alerts are all quiet, which is a real outcome. (Re-using either key idempotently refreshes it.)++## How a run works++Cycle between these moves; skip what's not useful.++### Get oriented++- `signals-scout-scratchpad-search` (`text=insight_alerts`, `limit=100`) — your durable+ steering: the baseline, which alerts you've already surfaced (`dedupe:`), which are known+ flappy/test (`noise:`), and which the team has muted or fixed (`addressed:`/`allowlist:`).+- `signals-scout-runs-list` (last 7d) — what prior runs of this scout surfaced and ruled out,+ so you don't re-file yesterday's digest.+- `alerts-list` — the cheap triage layer over **every** alert at once. Read each row's+ `state`, `enabled`, `snoozed_until`, `last_notified_at`, `last_checked_at`, `last_value`,+ `calculation_interval`, and threshold/`condition`/`detector_config`. This is your candidate+ funnel — don't pull per-alert history for all of them.++### Narrow to candidates (this matters on big projects)++A busy project can have hundreds of alerts; you cannot deep-read them all every run. From+`alerts-list`, keep only the alerts that are **enabled, not snoozed**, and match any of:++- `state` is `Firing` — currently breaching.+- `state` is `Errored` — silently not evaluating (a coverage blind spot).+- `last_notified_at` or `last_checked_at` falls inside your lookback window (default ~last+ 24h, a bit wider on a daily run) — fired and may have already resolved.++Everything else (`Not firing`, untouched in the window) is baseline — skip it. This typically+takes a few hundred alerts down to a handful.++### Deep-read each candidate++For each surviving candidate, pull the real firing episode — never trust `state`/`last_value`+alone (state can be stale, and `last_value` is just the latest check, not the breach that+fired). Use `alert-get` with `checks_date_from=-24h` (widen to `-48h`/`-7d` to judge+persistence and recurrence; history is retained 14 days). Read across the returned `checks`:++| Shape in the checks | What it usually means |+| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |+| One or more `Firing` checks, latest still `Firing`, no `notification_sent_at` | **Silent open breach — top priority.** Fired, nobody was told, still going. |+| `Firing` checks then back to `Not firing`, all within minutes/one interval | A **flap** — usually a badly-tuned threshold, not an incident. Hygiene, not a P1. |+| `Firing` with `notification_sent_at` set + subscribed users | The team was told. Lower value; surface only if material **and** still open/unacted. |+| `notification_suppressed_by_agent=true` | Investigation agent judged it a false positive — verify before trusting; possible false negative. |+| Repeated `error` across consecutive checks (`state=Errored`) | Alert is broken (bad query, deleted insight, missing series) — a silent blind spot. |++When in doubt about whether a breach is real, read the alert's `condition`/threshold bounds+and compare them against the firing check's `calculated_value`, and pull the insight with+`insight-get` to understand what the metric is.++### Save memory as you go++Write a scratchpad entry whenever a future run should change behavior. Encode the category in+the key prefix; key per-alert entries on the **alert id** (stable across firings).++- `pattern:insight_alerts:baseline-team{team_id}` — "~{N} enabled alerts, ~{X} firing/day,+ mostly hourly; many owners. {timestamp}"+- `dedupe:insight_alerts:{alert_id}:{fired_date}` — "{date}: surfaced firing of '{name}'+ (alert {alert_id}, insight {short_id}), value {v} vs bound {b}, silent. If still Firing next+ run, escalate; if resolved + notified, treat as covered."+- `noise:insight_alerts:{alert_id}` — "flaps every few hours on a too-tight bound; the firing+ itself isn't signal. Only surface as a one-off tuning hygiene finding, never per-flap."+- `addressed:insight_alerts:{alert_id}` / `allowlist:insight_alerts:{alert_id}` — team fixed+ / acked it, or owner deliberately keeps it low-priority — skip.++### Decide++Classify each candidate firing against prior runs and the scratchpad (net-new /+material-update / already-covered / addressed-or-noise), then:++- **Emit** via `signals-scout-emit-signal` when a firing clears the bar. Because the alert+ already did the detection, confidence is high once you've read the actual checks — a strong+ finding is: an enabled, un-snoozed alert with a **material** firing (well past its bound or a+ high anomaly score) inside the window that was **under-notified** (silent / suppressed) or is+ **still open and unacted**, with the alert id, insight `short_id`, the firing+ `calculated_value` vs the threshold bound, the fired-at time, and the notification status all+ in the evidence; confidence ≥ 0.7. Cross-check `inbox-reports-list` first.+- **Cap and rank.** Emit at most ~5 firings per run, worst-first by the discriminator. If more+ cleared the bar, say how many you dropped in the close-out — never silently truncate. (One+ digest-style finding that bundles several minor firings is also fine when none individually+ warrants its own entry; bundle the flapping/Errored hygiene items this way rather than one+ finding each.)+- **Remember** if it's suggestive but below the bar (a marginal breach, a single flap), or to+ refresh the baseline / record what you ruled out.+- **Skip** if a `noise:` / `addressed:` / `allowlist:` / `dedupe:` entry already covers it.++Severity: **P1** a material, silent firing on a clearly important metric; **P2** a material+firing that was notified but is still open/unacted; **P3** Errored-alert blind spots and+flapping-threshold hygiene.++dedupe_keys: `alert_firing:{alert_id}` plus `insight:{short_id}`. finding_id:+`insight-alert-{alert_id}-{date}`. A firing that recurs on a later day is a new finding that+cites the prior `finding_id`.++### Close out++One paragraph: how many alerts you triaged, which firings you surfaced (and why those), what+you ruled out (flaps, snoozed, already-notified-and-resolved), and how many cleared the bar+but were dropped for the per-run cap. The harness saves this as the run summary. "Triaged the+candidates, everything firing was already notified and acted on" is a real outcome — do not+write a separate run-metadata scratchpad entry.++## Disqualifiers (skip these)++- **Snoozed or disabled alerts** — `snoozed_until` in the future, or `enabled=false`. The+ owner explicitly muted these; a firing on a snoozed alert is not a miss.+- **Flapping alerts** — fire→resolve→fire within an interval with no sustained breach. That's+ a tuning problem, not an incident. At most **one** hygiene finding (P3) suggesting the bound+ be retuned; record `noise:` and stop surfacing the individual flaps.+- **Already-notified-and-resolved** — fired, the subscribed users were emailed/Slacked+ (`notification_sent_at` set), and it's back to `Not firing`. The team saw it and it's over;+ skip unless it's materially recurring across days.+- **Marginal breaches on low-count/noisy series** — `calculated_value` sitting right on the+ bound, or a tiny absolute count. Below the materiality floor; remember, don't emit.+- **Dev / test / internal-only alerts** — alerts on insights whose `$environment`/service is+ `dev`/`local`/`test`, or a single owner's sandbox alert. Not user-facing.+- **Transient single-check errors** — an alert that errored once and recovered. Only flag+ **persistent** Errored state across consecutive checks.++When in doubt, refresh memory instead of emitting.++## MCP tools++Direct (read-only):++- `alerts-list` — the cheap triage layer over every alert (state, enabled, snoozed,+ last_notified/checked, last_value, threshold/detector). Your candidate funnel.+- `alert-get` (`id`, `checks_date_from`, `checks_date_to`, `checks_limit`) — the real firing+ history for one candidate: per-check `state`, `calculated_value`, `targets_notified`,+ `notification_sent_at`, `notification_suppressed_by_agent`, `error`, anomaly scores.+- `insight-get` — what the alerted metric actually is (read when judging materiality).+- `inbox-reports-list` — check the firing isn't already reported before emitting.++Harness-level: `signals-scout-project-profile-get`, `signals-scout-scratchpad-search`,+`signals-scout-runs-list`, `signals-scout-runs-retrieve` (orientation + dedupe);+`signals-scout-emit-signal`, `signals-scout-scratchpad-remember`,+`signals-scout-scratchpad-forget` (emit + memory).++## When to stop++- No enabled alerts, or everything quiet → quick close-out.+- You've triaged the candidates and surfaced the worst few → close out, even if minor firings+ remain; the per-run cap is deliberate.+- A candidate matches a `noise:` / `addressed:` / `allowlist:` / `dedupe:` entry → skip.++Fewer, well-calibrated findings that genuinely catch missed firings beat a daily re-list of+every alert that happened to breach.