: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 a surfaces section to the scout project profile (#117920)
posthog[bot]f095c481e101
diff --git a/products/signals/backend/scout_harness/lazy_seed.py b/products/signals/backend/scout_harness/lazy_seed.pyindex c282ec38c9ef..6137a885c5d1 100644--- a/products/signals/backend/scout_harness/lazy_seed.py+++ b/products/signals/backend/scout_harness/lazy_seed.py@@ -691,6 +691,11 @@ def canonical_precheck_query_for(skill_name: str) -> str | None:return _canonical_precheck_queries().get(skill_name)+def canonical_precheck_queries() -> dict[str, str]:+ """The default pre-check of every canonical scout that ships one, keyed by scout name."""+ return dict(_canonical_precheck_queries())++@lru_cache(maxsize=1)def _canonical_deprecations() -> dict[str, ScoutDeprecation]:"""The retirement marker per canonical scout name, for the scouts PostHog is retiring.diff --git a/products/signals/backend/scout_harness/precheck.py b/products/signals/backend/scout_harness/precheck.pyindex f659fc7acdf5..8458f47f5999 100644--- a/products/signals/backend/scout_harness/precheck.py+++ b/products/signals/backend/scout_harness/precheck.py@@ -318,6 +318,25 @@ def dry_run_scout_precheck()+def run_precheck_query(+ team: Team,+ user: User,+ query: str,+ *,+ since: datetime,+ now: datetime,+ interval_minutes: int,+ timeout_s: int = PRECHECK_TIMEOUT_S,+) -> PrecheckResult:+ """Run a pre-check query as `user` and classify its rows like a scheduled run does.++ Raises on a query error, so the caller decides what an error means.+ """+ return _result_from_rows(+ _run_query(team, user, query, since=since, now=now, interval_minutes=interval_minutes, timeout_s=timeout_s)+ )++def precheck_since(config: SignalScoutConfig) -> datetime:"""The `{since}` bound: the last run that actually ran, or the config's creation."""last_run_at = (@@ -340,7 +359,14 @@ def _result_from_rows(found: _PrecheckRows) -> PrecheckResult:def _run_query(- team: Team, user: User, query: str, *, since: datetime, now: datetime, interval_minutes: int+ team: Team,+ user: User,+ query: str,+ *,+ since: datetime,+ now: datetime,+ interval_minutes: int,+ timeout_s: int = PRECHECK_TIMEOUT_S,) -> _PrecheckRows:parsed = parse_select(query, placeholders=_placeholders(since=since, now=now, interval_minutes=interval_minutes))capped = _cap_rows(parsed)@@ -351,7 +377,7 @@ def _run_query(team=team,user=user,workload=Workload.OFFLINE,- settings=HogQLGlobalSettings(max_execution_time=PRECHECK_TIMEOUT_S),+ settings=HogQLGlobalSettings(max_execution_time=timeout_s),)return _PrecheckRows(columns=response.columns or [], rows=(response.results or [])[:PRECHECK_MAX_ROWS])diff --git a/products/signals/backend/scout_harness/profile/builders.py b/products/signals/backend/scout_harness/profile/builders.pyindex e1760be556e5..fc7bc9ca7585 100644--- a/products/signals/backend/scout_harness/profile/builders.py+++ b/products/signals/backend/scout_harness/profile/builders.py@@ -20,14 +20,19 @@ items with name + status + timestamp. The agent gets MCP tools (`surveys-get-all`feature-flag-get-all`, `experiment-list`, `insights-trending-retrieve`, etc.) fordeep drilldowns; the profile only orients.+**Surface usage** — `surfaces`: whether each canonical scout's surface is in use, from that+scout's default pre-check query. `top_events` cannot answer this for a quiet surface.+Per-entity ordering picks `updated_at` / `last_modified_at` where available, fallingback to `created_at` for entities that don't track modifications (cohorts, alerts)."""from __future__ import annotations+import math+import timeimport logging-from datetime import timedelta+from datetime import datetime, timedeltafrom typing import Anyfrom django.db.models import Count, F, Max, Q@@ -42,6 +47,7 @@ from posthog.models.activity_logging.activity_log import ActivityLogfrom posthog.models.integration import Integrationfrom posthog.models.product_intent.product_intent import ProductIntentfrom posthog.models.team.team import Team+from posthog.models.user import Userfrom products.actions.backend.models.action import Actionfrom products.alerts.backend.facade.destinations import redact_urls_in_name@@ -61,7 +67,10 @@ from products.experiments.backend.models.experiment import Experimentfrom products.feature_flags.backend.models.feature_flag import FeatureFlagfrom products.notebooks.backend.facade import api as notebooksfrom products.signals.backend.models import SignalReport, SignalScoutConfig, SignalScoutRun, SignalSourceConfig+from products.signals.backend.scout_harness.acting_user import resolve_scout_run_acting_userfrom products.signals.backend.scout_harness.config_registry import live_scout_skill_names+from products.signals.backend.scout_harness.lazy_seed import canonical_precheck_queries+from products.signals.backend.scout_harness.precheck import PRECHECK_TIMEOUT_S, run_precheck_queryfrom products.signals.backend.scout_harness.profile.schema import Inventoryfrom products.signals.backend.scout_harness.team_limits import withheld_skills_for_teamfrom products.surveys.backend.models import Survey@@ -75,7 +84,7 @@ logger = logging.getLogger(__name__)# (or restructuring an existing one) without bumping the version would silently mix old# and new shapes in the cache. A redaction change bumps it too, so rows built before the# redaction stop being served.-INVENTORY_SOURCE_VERSION = "v15"+INVENTORY_SOURCE_VERSION = "v16"# Top-events ClickHouse query bounds. 7d is short enough to spot recent bursts and long# enough to stabilize counts on low-traffic teams; 50 covers the long tail without@@ -118,6 +127,13 @@ REVIEWER_CORRECTIONS_LIMIT = 20# most), so it needs no result cap of its own.SCOUT_FLEET_EMITTED_LOOKBACK_DAYS = 30+# `_surfaces` binds a pre-check's `{since}` to this many days before now, and `{interval_minutes}`+# to the same span. Most default queries carry their own window off `{now}` and ignore both.+SURFACES_LOOKBACK_DAYS = 30+# The total time the surface queries can take in one build. A surface that the budget leaves out+# reads as `in_use: null`.+SURFACES_TIME_BUDGET_S = 30+def build_inventory(team: Team) -> Inventory:"""Aggregate the deterministic inventory layer for a team.@@ -156,6 +172,7 @@ def build_inventory(team: Team) -> Inventory:"recent_actions": _recent_actions(team),"business_knowledge": _business_knowledge(team),"top_events": _top_events(team),+ "surfaces": _surfaces(team),})@@ -181,6 +198,9 @@ def _project_context(team: Team) -> dict[str, Any]:def _products_in_use(team: Team) -> list[str]:"""Products this team has completed onboarding for.+ Onboarding is not usage: a team can use a product it never onboarded, and the reverse.+ `surfaces` answers whether a surface is in use.+`Team.has_completed_onboarding_for` is a JSON map of `{product_key: bool}` — keyswe report are the ones the team explicitly finished onboarding. Missing or nullfield returns an empty list rather than raising.@@ -900,3 +920,69 @@ def _top_events(team: Team) -> list[dict[str, Any]] | None:}for row in rows]+++def _surfaces(team: Team) -> dict[str, dict[str, Any]]:+ """Whether each canonical scout's surface is in use, keyed by scout name.++ `top_events` keeps only the top events by volume, and `products_in_use` reads onboarding, so+ neither can show that a quiet surface is in use. Each canonical scout that ships a default+ pre-check (`scout-precheck-query`) already names the query that answers that question. This+ section runs that query and reads its rows like a scheduled pre-check does: rows mean+ `in_use: true`, no rows or one false value mean `in_use: false`.++ Each query runs as that scout's acting user, so it can read the same `system.*` and warehouse+ tables the scout can read. A query with no user loses those tables and reads as empty. An+ entry is `in_use: null` when the query fails, when no member can act, or when the build runs+ out of `SURFACES_TIME_BUDGET_S`. `source` names the cause. Held-back scouts are left out, so+ the payload does not disclose them.+ """+ queries = canonical_precheck_queries()+ configs = {+ config.skill_name: config+ for config in SignalScoutConfig.objects.for_team(team.id).filter(skill_name__in=queries.keys())+ }+ now = timezone.now()+ deadline = time.monotonic() + SURFACES_TIME_BUDGET_S+ return {+ skill_name: _surface_entry(team, skill_name, queries[skill_name], configs.get(skill_name), now, deadline)+ for skill_name in sorted(queries.keys() - withheld_skills_for_team(team.id))+ }+++def _surface_entry(+ team: Team, skill_name: str, query: str, config: SignalScoutConfig | None, now: datetime, deadline: float+) -> dict[str, Any]:+ unanswered: dict[str, Any] = {"in_use": None, "evaluated_at": None, "row_count": None}+ # Each query gets at most the time left in the build, so one slow query cannot pass the budget.+ remaining_s = math.floor(deadline - time.monotonic())+ if remaining_s < 1:+ return {**unanswered, "source": "time_budget"}+ acting_user = resolve_scout_run_acting_user(team, skill_name, config)+ user = User.objects.filter(pk=acting_user.user_id).first() if acting_user is not None else None+ if user is None:+ return {**unanswered, "source": "no_acting_user"}+ try:+ result = run_precheck_query(+ team,+ user,+ query,+ since=now - timedelta(days=SURFACES_LOOKBACK_DAYS),+ now=now,+ interval_minutes=SURFACES_LOOKBACK_DAYS * 24 * 60,+ timeout_s=min(PRECHECK_TIMEOUT_S, remaining_s),+ )+ except Exception:+ logger.warning(+ "signals_scout_profile: surface query failed for team_id=%s skill_name=%s",+ team.id,+ skill_name,+ exc_info=True,+ )+ return {**unanswered, "source": "query_error"}+ return {+ "in_use": result.should_run,+ "evaluated_at": now.isoformat(),+ "source": "skill_default",+ "row_count": result.row_count,+ }diff --git a/products/signals/backend/scout_harness/profile/schema.py b/products/signals/backend/scout_harness/profile/schema.pyindex aa9d50ab121f..cce9eab4f97e 100644--- a/products/signals/backend/scout_harness/profile/schema.py+++ b/products/signals/backend/scout_harness/profile/schema.py@@ -20,6 +20,8 @@ and columns that are `null=True` at the DB layer (`HogFunction.type`/`kind`,from __future__ import annotations+from typing import Literal+from pydantic import BaseModel, ConfigDict@@ -325,6 +327,24 @@ class TopEvent(_Section):last_seen_in_window: str | None+class SurfaceEntry(_Section):+ """Whether one canonical scout's surface is in use, from the scout's default pre-check query.++ Read this, not `top_events`, to decide whether a surface is in use: `top_events` keeps only the+ top events by volume, so a quiet surface that is in use falls off it.+ """++ # True when the query found rows. False when it found none, or one false value such as a zero+ # count. Null when the profile could not answer, so a reader must check the surface itself.+ in_use: bool | None+ evaluated_at: str | None+ # `skill_default` when the shipped default query answered. Otherwise the reason `in_use` is+ # null: `query_error`, `no_acting_user`, or `time_budget`.+ source: Literal["skill_default", "query_error", "no_acting_user", "time_budget"]+ # The rows the query returned, capped at the pre-check row cap. Null when `in_use` is null.+ row_count: int | None++class Inventory(_Section):"""The deterministic inventory layer of a `SignalProjectProfile.payload`.@@ -334,6 +354,8 @@ class Inventory(_Section):"""project_context: ProjectContext+ # The products the team finished onboarding for. Onboarding is not usage: read `surfaces` to+ # decide whether a surface is in use.products_in_use: list[str]product_intents: list[ProductIntentEntry]integrations: list[IntegrationEntry]@@ -356,3 +378,5 @@ class Inventory(_Section):recent_actions: RecentActionsbusiness_knowledge: BusinessKnowledgetop_events: list[TopEvent] | None+ # Keyed by scout name. One entry for each canonical scout that ships a default pre-check.+ surfaces: dict[str, SurfaceEntry]diff --git a/products/signals/backend/test/test_scout_harness_profile.py b/products/signals/backend/test/test_scout_harness_profile.pyindex edd663e307fe..c02433ffdea8 100644--- a/products/signals/backend/test/test_scout_harness_profile.py+++ b/products/signals/backend/test/test_scout_harness_profile.py@@ -10,7 +10,7 @@ from datetime import UTC, datetime, timedeltafrom types import SimpleNamespacefrom uuid import uuid4-from posthog.test.base import BaseTest+from posthog.test.base import BaseTest, ClickhouseTestMixin, _create_event, flush_persons_and_eventsfrom unittest.mock import MagicMock, patchfrom django.apps import apps@@ -43,6 +43,7 @@ from products.signals.backend.models import (SignalScoutRun,SignalSourceConfig,)+from products.signals.backend.scout_harness.lazy_seed import canonical_precheck_queriesfrom products.signals.backend.scout_harness.profile import INVENTORY_SOURCE_VERSION, Inventory, build_inventoryfrom products.signals.backend.scout_harness.profile.builders import (RECENT_ACTIVITY_WINDOW_DAYS,@@ -71,6 +72,7 @@ from products.signals.backend.scout_harness.profile.builders import (_recent_surveys,_scout_fleet,_signal_source_configs,+ _surfaces,_top_events,)from products.signals.backend.scout_harness.profile.schema import ScoutFleetEntry@@ -85,6 +87,8 @@ from products.surveys.backend.models import Surveyfrom products.warehouse_sources.backend.facade.models import ExternalDataJob, ExternalDataSchema, ExternalDataSourcefrom products.workflows.backend.facade.testing import create_workflow_for_test+BUILDERS = "products.signals.backend.scout_harness.profile.builders"+class TestProjectContext(BaseTest):def test_returns_product_description_and_app_urls(self) -> None:@@ -1016,6 +1020,66 @@ class TestTopEvents(BaseTest):]+class TestSurfaces(ClickhouseTestMixin, BaseTest):+ def test_every_shipped_default_runs_and_reads_a_quiet_surface_as_not_in_use(self) -> None:+ # An empty project: a backstop row (surveys) or a bad placeholder binding would read as in use.+ surfaces = _surfaces(self.team)++ assert set(surfaces) == set(canonical_precheck_queries())+ assert {name: (entry["source"], entry["in_use"]) for name, entry in surfaces.items()} == dict.fromkeys(+ surfaces, ("skill_default", False)+ )++ def test_an_event_outside_top_events_still_marks_its_surface_in_use(self) -> None:+ _create_event(+ team=self.team, event="$csp_violation", distinct_id="d1", timestamp=timezone.now() - timedelta(days=2)+ )+ flush_persons_and_events()++ entry = _surfaces(self.team)["signals-scout-csp-violations"]++ assert (entry["in_use"], entry["source"], entry["row_count"]) == (True, "skill_default", 1)+ assert entry["evaluated_at"] is not None++ @parameterized.expand(+ [+ ("rows", SimpleNamespace(columns=["n"], results=[[3]]), True, "skill_default", 1),+ ("no_rows", SimpleNamespace(columns=["n"], results=[]), False, "skill_default", 0),+ ("zero_count", SimpleNamespace(columns=["n"], results=[[0]]), False, "skill_default", 1),+ ("query_error", RuntimeError("clickhouse down"), None, "query_error", None),+ ]+ )+ def test_reads_rows_as_the_acting_user_and_survives_a_failed_query(+ self, _name, response, in_use, source, row_count+ ) -> None:+ with (+ patch(f"{BUILDERS}.canonical_precheck_queries", return_value={"signals-scout-x": "SELECT 1"}),+ patch(+ "products.signals.backend.scout_harness.precheck.execute_hogql_query", side_effect=[response]+ ) as query,+ ):+ surfaces = _surfaces(self.team)++ assert surfaces["signals-scout-x"]["in_use"] is in_use+ assert (surfaces["signals-scout-x"]["source"], surfaces["signals-scout-x"]["row_count"]) == (source, row_count)+ # With no user, every access-scoped `system.*` and warehouse table reads as empty.+ assert query.call_args.kwargs["user"] == self.user++ def test_withheld_scout_is_absent(self) -> None:+ queries = {"signals-scout-unreleased": "SELECT 1", "signals-scout-x": "SELECT 1"}+ with (+ patch(f"{BUILDERS}.canonical_precheck_queries", return_value=queries),+ patch(f"{BUILDERS}.withheld_skills_for_team", return_value={"signals-scout-unreleased"}),+ patch(+ "products.signals.backend.scout_harness.precheck.execute_hogql_query",+ return_value=SimpleNamespace(columns=["n"], results=[[1]]),+ ),+ ):+ surfaces = _surfaces(self.team)++ assert list(surfaces) == ["signals-scout-x"]++class TestBuildInventory(BaseTest):def test_returns_a_validated_inventory_with_all_sections(self) -> None:inventory = build_inventory(self.team)@@ -1044,6 +1108,7 @@ class TestBuildInventory(BaseTest):"recent_actions","business_knowledge","top_events",+ "surfaces",}def test_persisted_payload_revalidates_against_the_schema(self) -> None:diff --git a/products/signals/skills/authoring-scouts/references/scheduled-precheck.md b/products/signals/skills/authoring-scouts/references/scheduled-precheck.mdindex 2cada71c00c0..581f28ea6fce 100644--- a/products/signals/skills/authoring-scouts/references/scheduled-precheck.md+++ b/products/signals/skills/authoring-scouts/references/scheduled-precheck.md@@ -112,6 +112,7 @@ scout-precheck-query: |- The harness reads the default from the canonical skill file that PostHog ships, not from a project's copy of the skill.Adding `scout-precheck-query` to a custom scout or to a team's edited copy changes nothing. For those scouts, save `precheck_query` on the config.- A merged default does not apply to every project at once. A rollout setting decides which projects get it.+- The project profile's `surfaces` section runs every canonical default too, and reads its rows as "this surface is in use". Keep a default a test of activity on the surface. A backstop row or a "new since the last run" filter changes that answer for every project. `surfaces` binds `{since}` and `{interval_minutes}` to a 30-day span.- When you write a canonical default, use the canonical scouts that already ship one (for example `signals-scout-mcp-tool-calls` above, or `signals-scout-surveys`) as models.## Tell the body about the rowsdiff --git a/products/signals/skills/authoring-scouts/references/scout-anatomy.md b/products/signals/skills/authoring-scouts/references/scout-anatomy.mdindex aaac6db53493..40885649ffab 100644--- a/products/signals/skills/authoring-scouts/references/scout-anatomy.md+++ b/products/signals/skills/authoring-scouts/references/scout-anatomy.md@@ -74,8 +74,9 @@ The fleet's specialists all share this shape:Examples: `count` vs `distinct_users` ratio (error tracking); reach over raw count (CSP); negative+mixed share vs baseline (MCP feedback).Without this, the scout wastes every run re-deciding what "normal" means.-2. **Quick close-out.** A cheap early-exit so a quiet run costs almost nothing: if the watched event is absent from the profile's `top_events` or sitting at baseline (no fresh 24h activity), write one scratchpad entry and stop.+2. **Quick close-out.** A cheap early-exit so a quiet run costs almost nothing: if the surface is not in use, or the watched event sits at baseline (no fresh 24h activity), write one scratchpad entry and stop.This keeps idle scouts cheap.+ Decide "not in use" from the profile's `surfaces` entry for the scout, never from absence in `top_events`: `top_events` keeps only the top events by volume, so a quiet surface that is in use falls off it. A canonical scout gets a `surfaces` entry when it ships a `scout-precheck-query`. A scout with no entry, or an entry that reads `in_use: null`, checks with one bounded `execute-sql` count.`top_events` counts are windowed (each row carries `window_days`), not lifetime — a project whose ingestion recently went dark reads identically to one that never had traffic. Before closing out a busy-looking project as empty on `top_events` thinness alone, rule out a capture gap with a direct `execute-sql` over a longer window (e.g. 30d); only close out when the low volume holds there.```text@@ -157,8 +158,8 @@ signal-vs-noise discriminator. Internalize that shape.## Quick close-out: is <surface> even loud?-If <event> is absent from `top_events` or at baseline (no fresh 24h activity), <surface>-isn't where the signal is today. Cheap scratchpad entry + close out empty.+If `surfaces["<skill-name>"]` reads `in_use: false`, or <event> is at baseline (no fresh 24h activity), <surface>+isn't where the signal is today. Absence from `top_events` alone proves nothing. Cheap scratchpad entry + close out empty.## How a run worksdiff --git a/products/signals/skills/signals-scout-ai-observability/SKILL.md b/products/signals/skills/signals-scout-ai-observability/SKILL.mdindex 56fdf3ba883d..93ae5faddaf3 100644--- a/products/signals/skills/signals-scout-ai-observability/SKILL.md+++ b/products/signals/skills/signals-scout-ai-observability/SKILL.md@@ -43,10 +43,10 @@ If a history reader is unavailable or access is denied, stop using that reader fA 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:+If the profile's `surfaces["signals-scout-ai-observability"]` entry reads `in_use: false` (no `$ai_*` event in 7 days) **and** `get-llm-total-costs-for-project` shows near-zero spend, this team isn't using AI observability. Absence from `top_events` does not prove that, because it keeps only the top events by volume. When the entry reads `in_use: null`, count the `$ai_*` events over 7 days with `execute-sql` instead. Write one scratchpad entry:- key: `not-in-use:llm_analytics:team{team_id}`-- content: brief note ("checked at {timestamp}, no LLM events in top_events, $0 cost")+- content: brief note ("checked at {timestamp}, no LLM events in 7d, $0 cost")Close out empty. Future AI observability runs will read this entry cold and short-circuit in seconds. Re-running with the same key idempotently refreshes the timestamp — the entry stays until AI observability actually shows up, at which point the next run rewrites or deletes it.diff --git a/products/signals/skills/signals-scout-conversations/SKILL.md b/products/signals/skills/signals-scout-conversations/SKILL.mdindex e022eafb14e6..e3ed96d09732 100644--- a/products/signals/skills/signals-scout-conversations/SKILL.md+++ b/products/signals/skills/signals-scout-conversations/SKILL.md@@ -49,8 +49,9 @@ Your unit is always a dated, dimension-named operational metric across many tickA 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:+If the profile's `surfaces["signals-scout-conversations"]` entry reads `in_use: false`, the Conversations product isn't in use here.+Do not read absence from `top_events` as "not in use": it keeps only the top events by volume, and a quiet inbox falls off it.+When the entry reads `in_use: null`, check with one `execute-sql` over 30 days:```sqlSELECT event, count() AS c, max(timestamp) AS last_seendiff --git a/products/signals/skills/signals-scout-csp-violations/SKILL.md b/products/signals/skills/signals-scout-csp-violations/SKILL.mdindex 2d7a81e7d99b..981c50c4a41e 100644--- a/products/signals/skills/signals-scout-csp-violations/SKILL.md+++ b/products/signals/skills/signals-scout-csp-violations/SKILL.md@@ -42,14 +42,19 @@ If a history reader is unavailable or access is denied, stop using that reader fA 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:+`top_events` keeps only the top events by volume, so a quiet `$csp_violation` stream can be missing from it.+When the row is missing and the surface is in use, read the counts with one 7-day `execute-sql`.++If `$csp_violation` 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}`- content: `"$csp_violation baseline ~{count}/day, no fresh 24h burst at {timestamp}"`**Before** taking the baseline close-out, run the [standing enforced / first-party block](#standing-enforced--first-party-block-no-freshness-required) check below. "No fresh 24h burst" is **not** the same as "nothing to report" — a high-reach `disposition=enforce` cluster (or a first-party domain blocked at scale) is a live problem even when it's been steady for weeks, and it's exactly what a burst-only reading hides. Only close out as baseline once that check is also clean.-If `$csp_violation` is absent from `top_events` entirely (project doesn't ship a CSP reporting endpoint at all):+If the profile's `surfaces["signals-scout-csp-violations"]` entry reads `in_use: false`, the project doesn't ship a CSP reporting endpoint at all.+When the entry reads `in_use: null`, check with a 7-day `execute-sql` count before you decide.+Do not read absence from `top_events` as "not in use".- key: `not-in-use:csp_violations:team{team_id}`- content: brief note (`"no $csp_violation events in 7d window at {timestamp}"`)@@ -66,7 +71,7 @@ Four cheap reads cold-start a run:- `scout-scratchpad-search` (`text=csp` or `text=blocked`) — durable team steering from past CSP runs. Entries with `pattern:`, `noise:`, `addressed:`, `dedupe:`, `allowlist:`, `report:`, or `reviewer:` key prefixes tell you the team's healthy domains, recurring browser-extension noise, clusters already surfaced, which report covers a cluster, who owns a surface, and what to skip.- `scout-runs-list` (last 7d) — what prior CSP scouts found and ruled out.-- `scout-project-profile-get` — the `$csp_violation` row in `top_events` carries `count`, `distinct_users`, `recent_24h_count`, `recent_24h_users`, plus `existing_inbox_reports`. Pattern the count/users ratio against the table below.+- `scout-project-profile-get` — `surfaces["signals-scout-csp-violations"]` says whether CSP reporting is in use. The `$csp_violation` row in `top_events`, when the event ranks high enough to have one, carries `count`, `distinct_users`, `recent_24h_count`, `recent_24h_users`, plus `existing_inbox_reports`. Pattern the count/users ratio against the table below.- `inbox-reports-list` (`ordering=-updated_at`, `search`=the blocked domain / directive) — the reports already in the inbox. **Two source_products matter here:** your own report-channel reports persist under `source_product=signals_scout` (search these for edit-vs-author — don't filter them out), while the companion push path files raw per-fingerprint signals under `source_product=csp_reporting` (check these to stay quiet when the push path already covers a cluster — see Decide). A cluster you've reported before is an edit candidate (see Decide for the material-change bar); pull the closest matches with `inbox-reports-retrieve` before authoring.### Profile shape — count vs distinct_usersdiff --git a/products/signals/skills/signals-scout-customer-analytics-billing-and-usage/SKILL.md b/products/signals/skills/signals-scout-customer-analytics-billing-and-usage/SKILL.mdindex 018cc42620a0..28175842b735 100644--- a/products/signals/skills/signals-scout-customer-analytics-billing-and-usage/SKILL.md+++ b/products/signals/skills/signals-scout-customer-analytics-billing-and-usage/SKILL.md@@ -62,7 +62,7 @@ The generic report mechanics live in the harness prompt; this body carries onlyClose out empty (after one scratchpad entry) if any of these hold:-- `customer_analytics` not in the profile's `products_in_use`, or `system.accounts` is empty → `not-in-use:customer_analytics_billing_and_usage:team{team_id}`.+- `system.accounts` is empty → `not-in-use:customer_analytics_billing_and_usage:team{team_id}`. Do not close out on `products_in_use`: it lists onboarding, not usage.- The billing views are unreachable → `pattern:customer_analytics_billing_and_usage:no-billing-source:team{team_id}`.Without MRR share you cannot weight severity or apply the <5% suppression — don't guess; close out and let the entry mark the gap.- The roster doesn't join to billing (Orient's overlap check finds ~0 `external_id` ↔ `organization_id` matches) → `pattern:customer_analytics_billing_and_usage:billing-join-unlinked:team{team_id}`.diff --git a/products/signals/skills/signals-scout-customer-analytics/SKILL.md b/products/signals/skills/signals-scout-customer-analytics/SKILL.mdindex da507c1cd489..6eb358900583 100644--- a/products/signals/skills/signals-scout-customer-analytics/SKILL.md+++ b/products/signals/skills/signals-scout-customer-analytics/SKILL.md@@ -49,7 +49,7 @@ A scheduled run can start with a `<precheck_result>` block. Its one row counts tClose out empty (after one scratchpad entry) if any of these hold:-- `customer_analytics` is **not** in the profile's `products_in_use`, or `system.accounts` is empty (`SELECT count() FROM system.accounts` is 0) → `not-in-use:customer_analytics:team{team_id}`.+- The profile's `surfaces["signals-scout-customer-analytics"]` entry reads `in_use: false`, or `system.accounts` is empty (`SELECT count() FROM system.accounts` is 0) → `not-in-use:customer_analytics:team{team_id}`. Do not close out on `products_in_use`: it lists onboarding, not usage.- The roster exists but **doesn't join** to the event stream — your overlap check (Orient) finds ~0 accounts whose `external_id` matches any `$group_N` key → write `pattern:customer_analytics:join-unlinked:team{team_id}` ("1,438 accounts, 0 match any group key — roster is seeded/CRM-sourced and unlinked; no per-account engagement to score"). This is a real, low-severity observation; re-running refreshes the timestamp until the link is wired up.Re-running with the same key idempotently refreshes the timestamp.diff --git a/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md b/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.mdindex 177ff89d8a22..e69a251614ee 100644--- a/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md+++ b/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md@@ -80,7 +80,7 @@ The full SQL cookbook is in [`references/queries.md`](references/queries.md) —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:+If the profile's `surfaces["signals-scout-mcp-tool-calls"]` entry reads `in_use: false` (or, when it reads `in_use: null`, a 7-day `count()` is ~0), this project isn't using the PostHog MCP. Absence from `top_events` does not prove that, because it keeps only the top events by volume. Write one scratchpad entry and stop:- key: `not-in-use:mcp_analytics` (the scratchpad is already team-scoped — no id in the key)- content: brief note ("checked at {timestamp}, no $mcp_tool_call events in 7d")@@ -90,7 +90,7 @@ If `$mcp_tool_call` is absent from the profile's `top_events` (or a 7-day `count- Governed baseline: when your run prompt has a _Governed metrics_ section and `metric-list` shows an approved metric for the project-wide MCP tool-call failure rate, run it via `data-catalog-metric-run` as the baseline and refresh `pattern:mcp_analytics:baseline` from its output. Per-tool, per-category, struggle, and latency numbers stay cookbook SQL.- `scout-scratchpad-search` (`text=mcp`) — durable steering from past runs. `pattern:` entries hold the baseline rates and the captured **regime** (hono vs external-SDK) so you don't re-probe it cold; `noise:` / `addressed:` / `dedupe:` say what's benign, fixed, or already filed; `report:` / `reviewer:` entries point at the open report for a category and who owns it.- `scout-runs-list` (last 7d) — what prior MCP runs found and ruled out.-- `scout-project-profile-get` — confirm `$mcp_tool_call` reach off `top_events`.+- `scout-project-profile-get` — `surfaces["signals-scout-mcp-tool-calls"]` for whether MCP is in use, and `$mcp_tool_call` reach off `top_events` when it ranks there.- `inbox-reports-list` (`search`=a category or tool name, `ordering=-updated_at`) — the reports already in the inbox. A category you've reported before is an **edit**, not a fresh report; pull the closest matches with `inbox-reports-retrieve` before authoring. Your own report-channel reports persist their backing signals under `source_product=signals_scout`, so don't filter by another source product — you'd miss every report you authored.## Field-coverage probediff --git a/products/signals/skills/signals-scout-product-analytics/SKILL.md b/products/signals/skills/signals-scout-product-analytics/SKILL.mdindex 7096013c9744..2d6a590021e3 100644--- a/products/signals/skills/signals-scout-product-analytics/SKILL.md+++ b/products/signals/skills/signals-scout-product-analytics/SKILL.md@@ -42,7 +42,8 @@ You can't scan a whole project in one run. Your leverage is a **durable watchlis## Quick close-out: is there a flow worth watching?-If `scout-project-profile-get` shows `product_analytics` is **not** in `products_in_use`, **or** there are no saved funnel/retention/lifecycle insights (check via the `system.insights` search below) **and** `top_events` is too thin to infer even one activation flow (fewer than ~3 discrete business events above ~100/day), this team has no behavioral flow to score yet. Write one `not-in-use:product_analytics:team{team_id}` scratchpad entry and close out empty. Re-running with the same key idempotently refreshes the timestamp.+If there are no saved funnel/retention/lifecycle insights (check via the `system.insights` search below) **and** `top_events` is too thin to infer even one activation flow (fewer than ~3 discrete business events above ~100/day), this team has no behavioral flow to score yet. Write one `not-in-use:product_analytics:team{team_id}` scratchpad entry and close out empty. Re-running with the same key idempotently refreshes the timestamp.+Do not close out because `product_analytics` is missing from `products_in_use`: that list shows onboarding, not usage.Before closing out on `top_events` thinness, rule out a capture gap: its counts are windowed (each row carries `window_days`), not lifetime, so a project whose ingestion recently went dark reads identically to one that never had a flow. If the events look thin for a team that otherwise looks active, confirm with a direct `execute-sql` over a longer window (e.g. 30d) before concluding there's no flow — a recent capture cliff is a volume problem for another surface, not an absence of behavior to score.