Skip to content

: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.

feat(signals): ship events-only default pre-checks for six product scouts (#115167)

posthog[bot]7e907e9fcfe3
diff --git a/products/signals/backend/test/test_scout_precheck.py b/products/signals/backend/test/test_scout_precheck.py
index ccdda371afcc..5f0e9e53ecd7 100644
--- a/products/signals/backend/test/test_scout_precheck.py
+++ b/products/signals/backend/test/test_scout_precheck.py
@@ -208,6 +208,40 @@ class TestSkillDefaultPrecheck(ClickhouseTestMixin, BaseTest):
assert properties["query_source"] == "skill_default"
assert properties["rollout_bucket"] is not None
+ @parameterized.expand(
+ [
+ ("ai_observability_active", "signals-scout-ai-observability", "$ai_span", 24 * 6, "run"),
+ ("ai_observability_quiet", "signals-scout-ai-observability", "$ai_span", 24 * 8, "skip"),
+ ("csp_active", "signals-scout-csp-violations", "$csp_violation", 24 * 6, "run"),
+ ("csp_quiet", "signals-scout-csp-violations", "$csp_violation", 24 * 8, "skip"),
+ ("mcp_active", "signals-scout-mcp-tool-calls", "$mcp_tool_call", 24 * 6, "run"),
+ ("mcp_quiet", "signals-scout-mcp-tool-calls", "$mcp_tool_call", 24 * 8, "skip"),
+ ("conversations_active", "signals-scout-conversations", "$conversation_message_sent", 24 * 29, "run"),
+ ("conversations_quiet", "signals-scout-conversations", "$conversation_ticket_created", 24 * 31, "skip"),
+ ("conversations_widget_event", "signals-scout-conversations", "$conversations_widget_opened", 1, "skip"),
+ ("web_vitals_active", "signals-scout-web-vitals", "$web_vitals", 24 * 6, "run"),
+ ("web_vitals_quiet", "signals-scout-web-vitals", "$web_vitals", 24 * 8, "skip"),
+ ("web_analytics_active", "signals-scout-web-analytics", "$pageview", 24 * 6, "run"),
+ ("web_analytics_quiet", "signals-scout-web-analytics", "$pageview", 24 * 8, "skip"),
+ ]
+ )
+ def test_product_presence_defaults_skip_only_on_absence(self, _name, skill, event, hours_ago, outcome) -> None:
+ LLMSkill.objects.create(
+ team=self.team, name=skill, description="", body="", metadata={"seeded_by": HARNESS_SEEDED_BY}
+ )
+ SignalScoutConfig.all_teams.create(team=self.team, skill_name=skill)
+ _create_event(team=self.team, event=event, distinct_id="d1", timestamp=NOW - timedelta(hours=hours_ago))
+ flush_persons_and_events()
+
+ with (
+ patch(ROLLOUT_PERCENT, return_value=100),
+ patch("products.signals.backend.scout_harness.precheck.posthoganalytics.capture"),
+ ):
+ result = evaluate_scout_precheck(self.team.pk, skill)
+
+ assert result is not None
+ assert (result.outcome, result.query_source) == (outcome, "skill_default")
+
def test_project_outside_the_rollout_runs_as_before(self) -> None:
result, capture = self._evaluate(rollout_percent=0)
diff --git a/products/signals/skills/signals-scout-ai-observability/SKILL.md b/products/signals/skills/signals-scout-ai-observability/SKILL.md
index f351335e648c..56fdf3ba883d 100644
--- a/products/signals/skills/signals-scout-ai-observability/SKILL.md
+++ b/products/signals/skills/signals-scout-ai-observability/SKILL.md
@@ -19,6 +19,12 @@ scout-tags:
metadata:
owner_team: signals
scope: llm_analytics
+scout-precheck-query: |
+ SELECT event, count() AS events, max(timestamp) AS last_seen
+ FROM events
+ WHERE event IN ('$ai_generation', '$ai_evaluation', '$ai_trace', '$ai_span', '$ai_metric', '$ai_feedback')
+ AND timestamp > {now} - INTERVAL 7 DAY
+ GROUP BY event
---
# Signals scout: AI observability
@@ -35,6 +41,8 @@ If a history reader is unavailable or access is denied, stop using that reader f
## Quick close-out: is AI observability even in use?
+A scheduled run can start with a `<precheck_result>` block. Each row counts one AI event that arrived in the last 7 days, so AI observability is in use. When the block is present, skip this check.
+
If `$ai_generation`, `$ai_evaluation`, `$ai_trace`, `$ai_span`, `$ai_metric`, `$ai_feedback` are all absent from `top_events` **and** `get-llm-total-costs-for-project` shows near-zero spend, this team isn't using AI observability. Write one scratchpad entry:
- key: `not-in-use:llm_analytics:team{team_id}`
diff --git a/products/signals/skills/signals-scout-conversations/SKILL.md b/products/signals/skills/signals-scout-conversations/SKILL.md
index 39a41638b627..e022eafb14e6 100644
--- a/products/signals/skills/signals-scout-conversations/SKILL.md
+++ b/products/signals/skills/signals-scout-conversations/SKILL.md
@@ -15,6 +15,12 @@ allowed_tools:
metadata:
owner_team: signals
scope: conversations
+scout-precheck-query: |
+ SELECT event, count() AS events, max(timestamp) AS last_seen
+ FROM events
+ WHERE (startsWith(event, '$conversation_ticket') OR startsWith(event, '$conversation_message'))
+ AND timestamp > {now} - INTERVAL 30 DAY
+ GROUP BY event
---
# Signals scout: Conversations (support inbox)
@@ -41,6 +47,8 @@ Your unit is always a dated, dimension-named operational metric across many tick
## Quick close-out: is the inbox even in use?
+A scheduled run can start with a `<precheck_result>` block. Its rows are the result of the 30-day query below, so the inbox is in use. When the block is present, skip the `not-in-use` check. The baseline close-out still applies.
+
If `$conversation_ticket_created` is absent from `top_events` (and `$conversation_message_sent` / `_received` are too), the Conversations product isn't in use here.
`top_events` counts are windowed, so before closing out a busy-looking project, rule out a capture gap with one `execute-sql` over 30 days:
diff --git a/products/signals/skills/signals-scout-csp-violations/SKILL.md b/products/signals/skills/signals-scout-csp-violations/SKILL.md
index 4a16036be32c..2d7a81e7d99b 100644
--- a/products/signals/skills/signals-scout-csp-violations/SKILL.md
+++ b/products/signals/skills/signals-scout-csp-violations/SKILL.md
@@ -16,6 +16,12 @@ allowed_tools:
metadata:
owner_team: signals
scope: csp_violations
+scout-precheck-query: |
+ SELECT event, count() AS events, max(timestamp) AS last_seen
+ FROM events
+ WHERE event = '$csp_violation'
+ AND timestamp > {now} - INTERVAL 7 DAY
+ GROUP BY event
---
# Signals scout: CSP violations
@@ -34,6 +40,8 @@ If a history reader is unavailable or access is denied, stop using that reader f
## Quick close-out: is CSP reporting even active?
+A scheduled run can start with a `<precheck_result>` block. Its row counts the `$csp_violation` events of the last 7 days, so CSP reporting is in use. When the block is present, skip the `not-in-use` close-out. The baseline close-out and the standing enforced / first-party block check still apply.
+
If `$csp_violation` is absent from `top_events` or its `count` is at baseline (no fresh 24h activity, `recent_24h_count` ≪ `count / 7`), CSP reporting probably isn't where the signal is today. Cheap scratchpad entry + close out:
- key: `pattern:csp_violations:baseline-team{team_id}`
diff --git a/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md b/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md
index 143e5c1d1ebd..177ff89d8a22 100644
--- a/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md
+++ b/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md
@@ -19,6 +19,12 @@ allowed_tools:
metadata:
owner_team: signals
scope: mcp_analytics
+scout-precheck-query: |
+ SELECT event, count() AS events, max(timestamp) AS last_seen
+ FROM events
+ WHERE event = '$mcp_tool_call'
+ AND timestamp > {now} - INTERVAL 7 DAY
+ GROUP BY event
---
# Signals scout: MCP tool calls
@@ -72,6 +78,8 @@ The full SQL cookbook is in [`references/queries.md`](references/queries.md) —
## Quick close-out: is MCP even in use?
+A scheduled run can start with a `<precheck_result>` block. Its row counts the `$mcp_tool_call` events of the last 7 days, so MCP is in use. When the block is present, skip this check.
+
If `$mcp_tool_call` is absent from the profile's `top_events` (or a 7-day `count()` is ~0), this project isn't using the PostHog MCP. Write one scratchpad entry and stop:
- key: `not-in-use:mcp_analytics` (the scratchpad is already team-scoped — no id in the key)
diff --git a/products/signals/skills/signals-scout-web-analytics/SKILL.md b/products/signals/skills/signals-scout-web-analytics/SKILL.md
index 25b9a87c793d..a9596729e36d 100644
--- a/products/signals/skills/signals-scout-web-analytics/SKILL.md
+++ b/products/signals/skills/signals-scout-web-analytics/SKILL.md
@@ -19,6 +19,12 @@ allowed_tools:
metadata:
owner_team: signals
scope: web_analytics
+scout-precheck-query: |
+ SELECT 1 AS pageview_seen
+ FROM events
+ WHERE event = '$pageview'
+ AND timestamp > {now} - INTERVAL 7 DAY
+ LIMIT 1
---
# Signals scout: web analytics
@@ -41,6 +47,8 @@ Three mechanical facts anchor everything:
## Quick close-out: is there web traffic at all?
+A scheduled run can start with a `<precheck_result>` block. The block means that at least one `$pageview` arrived in the last 7 days, so the project has web traffic. It holds no session counts, so still run the query below: `pageviews_7d` can still be near zero.
+
One cheap read tells you the posture:
```sql
diff --git a/products/signals/skills/signals-scout-web-vitals/SKILL.md b/products/signals/skills/signals-scout-web-vitals/SKILL.md
index 0ea99e2b9c59..4d55796e2515 100644
--- a/products/signals/skills/signals-scout-web-vitals/SKILL.md
+++ b/products/signals/skills/signals-scout-web-vitals/SKILL.md
@@ -18,6 +18,12 @@ allowed_tools:
metadata:
owner_team: signals
scope: web_vitals
+scout-precheck-query: |
+ SELECT 1 AS web_vitals_seen
+ FROM events
+ WHERE event = '$web_vitals'
+ AND timestamp > {now} - INTERVAL 7 DAY
+ LIMIT 1
---
# Signals scout: web vitals
@@ -94,6 +100,8 @@ If a history reader is unavailable or access is denied, stop using that reader f
## Quick close-out: is web vitals capture even on?
+A scheduled run can start with a `<precheck_result>` block. The block means that at least one `$web_vitals` event arrived in the last 7 days. It holds no count, so still run the count below when you need the volume. A trickle is not `not-in-use`.
+
`$web_vitals` is opt-in (`capture_performance` in the SDK). Absence is **configuration,
not health** — it is the health-checks scout's territory, not yours.