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.

fix(signals): give the revenue scout a read path for its config (#108959)

posthog[bot]647a07f33712
diff --git a/products/signals/skills/signals-scout-revenue-analytics/SKILL.md b/products/signals/skills/signals-scout-revenue-analytics/SKILL.md
index 080fdf3bd0e7..e0399a9db5c4 100644
--- a/products/signals/skills/signals-scout-revenue-analytics/SKILL.md
+++ b/products/signals/skills/signals-scout-revenue-analytics/SKILL.md
@@ -3,7 +3,7 @@ name: signals-scout-revenue-analytics
scout-display-name: Revenue analytics
description: >
Signals scout for PostHog revenue analytics. Watches for upstream failures (Stripe sync
- stalls, capture regressions), config drift, and goal-miss escalations.
+ stalls, capture regressions), and config drift.
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) +
@@ -22,7 +22,7 @@ metadata:
You are a focused revenue analytics scout. Revenue analytics is a **derived product** — it doesn't have its own event stream; it standardizes data from two upstream paths into the `revenue_analytics_*` managed views (charge, customer, mrr, product, revenue_item, subscription):
-- **Events source** — team-configured revenue events (e.g. `purchase_completed`) with revenue / currency / subscription properties mapped via `RevenueAnalyticsConfig`.
+- **Events source** — team-configured revenue events (e.g. `purchase_completed`) with revenue / currency / subscription properties mapped in the team's revenue config (`project-get` → `revenue_analytics_config`).
- **Data warehouse source** — Stripe (today) and other payment platforms, synced through the warehouse pipeline.
Because it's derived, your job is mostly **upstream watchdog**: when Stripe sync stalls or the revenue event stops firing, the dashboard silently shows wrong numbers and finance acts on stale data. That's the high-impact class. Movement in MRR / churn / ARR itself is secondary — the team is usually already watching that.
@@ -31,36 +31,78 @@ Revenue numbers have a high panic radius — false positives erode trust faster
You author reports directly via the report channel (`scout-emit-report` / `scout-edit-report`): you've done the research, so you own each finding 1:1 end-to-end as an inbox report rather than firing a weak signal for a pipeline to cluster. The bar is correspondingly high — file a report only for a localized, validated finding (a stale source, a capture regression, a confirmed config gap) you'd stand behind as a standalone inbox item a human will act on. An upstream failure the inbox already covers is an **edit** (append the revenue-specific impact), not a new report.
+## Read the revenue config
+
+`project-get` (no `id`, so it reads the active project) is the supported read path for the team's revenue config. Its `revenue_analytics_config` field carries:
+
+- `events[]` — one `RevenueAnalyticsEventItem` per configured revenue event: `eventName`, `revenueProperty`, `revenueCurrencyProperty` (`{property}` or `{static}`), `subscriptionProperty`, `productProperty`, `couponProperty`, `currencyAwareDecimal`.
+- `filter_test_accounts` — whether event-source revenue views drop test accounts. Stripe and other warehouse views ignore it.
+
+Revenue goals no longer exist. Do not look for `goals`.
+
+If `project-get` fails, fall back to the managed views. There is no cross-source view. Each configured event builds its own views named `revenue_analytics.events.<event_name>.<kind>_events_revenue_view`, where every non-alphanumeric character in the event name becomes `_`. List the event charge views:
+
+```sql
+SELECT table_name
+FROM system.information_schema.tables
+WHERE table_name LIKE 'revenue_analytics.events.%.charge_events_revenue_view'
+```
+
+To check the volume of one event, query its view:
+
+```sql
+SELECT event_name, count() AS charges, max(timestamp) AS last_charge
+FROM revenue_analytics.events.<event_name>.charge_events_revenue_view
+WHERE timestamp > now() - INTERVAL 90 DAY
+GROUP BY event_name
+```
+
+The fallback has limits. Say so in any finding that relies on it:
+
+- A view name carries the event name with `_` in place of special characters. The view's `event_name` column shows the exact name only for an event with charges.
+- It does not show the property mapping. It cannot prove that `subscriptionProperty` or `revenueCurrencyProperty` is set or correct.
+- It does not show `filter_test_accounts`.
+
## Quick close-out: is revenue analytics even active?
-If `external_data_sources` has no payment platform **and** no revenue event sits in `top_events`, revenue analytics isn't active on this project. Write one scratchpad entry:
+Revenue analytics is active when either source is present:
+
+- `external_data_sources` has a payment platform, or
+- `revenue_analytics_config.events` from `project-get` is not empty.
+
+`top_events` does not prove that revenue analytics is inactive. A low-volume revenue event often falls out of `top_events`. Use `top_events` only to check the reach of an event that the config names.
+
+If neither source is present, write one scratchpad entry:
- key: `not-in-use:revenue_analytics:team{team_id}`
-- content: brief note ("checked at {timestamp}, no payment platform, no revenue events")
+- content: brief note ("checked at {timestamp}, no payment platform, `revenue_analytics_config.events` empty")
Close out empty. Future revenue runs read this entry cold and short-circuit fast. Re-running with the same key idempotently refreshes the timestamp — the entry stays until revenue analytics actually becomes active, at which point the next run rewrites or deletes it.
+If `project-get` failed and the fallback listing failed or found no event charge views, do not write the `not-in-use:` entry. The fallback cannot prove that no event is configured. If `external_data_sources` has a payment platform, continue the run and check that source. Otherwise, close out empty. In both cases, say in the run summary that the config was unreadable.
+
## How a run works
Cycle between these moves; skip what's not useful.
### Get oriented
-Three cheap reads cold-start a run:
+Four cheap reads cold-start a run:
-- `scout-scratchpad-search` (`text=revenue` or `text=stripe`) — durable team steering. Entries with `pattern:`, `noise:`, `addressed:`, or `dedupe:` key prefixes, plus the team's known revenue event name, Stripe source label, currency mix, and goals.
+- `scout-scratchpad-search` (`text=revenue` or `text=stripe`) — durable team steering. Entries with `pattern:`, `noise:`, `addressed:`, or `dedupe:` key prefixes, plus the team's known revenue event name, Stripe source label, and currency mix.
- `scout-runs-list` (last 7d) — what prior revenue runs found and ruled out.
-- `scout-project-profile-get` — `external_data_sources` (Stripe status), `top_events` (configured revenue event reach), `popular_insights` / `recent_dashboards` (revenue chart load-bearingness), `product_intents` (stuck onboarding).
+- `project-get` — `revenue_analytics_config` (configured revenue events and their property mapping, `filter_test_accounts`). See [Read the revenue config](#read-the-revenue-config).
+- `scout-project-profile-get` — `external_data_sources` (Stripe status), `top_events` (reach of the events that the config names), `popular_insights` / `recent_dashboards` (revenue chart load-bearingness), `product_intents` (stuck onboarding).
### Profile shape — what's loud today?
-| Pattern | What it usually means |
-| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
-| Stripe-shaped `external_data_sources` row with `status = failed` or stuck `running` | Revenue dashboard silently stale — high-impact upstream watchdog |
-| Configured revenue event missing or sharply down in `top_events` | Capture regression — MRR / gross revenue dropping artificially |
-| `popular_insights` includes revenue chart and chart's source is unhealthy | Confirmed downstream impact — high-confidence finding |
-| `product_intents` lists revenue analytics but no Stripe source and no event configured | Stuck onboarding — write memory, don't report |
-| Recent revenue dashboard view counts unchanged after a known revenue movement | Team isn't watching — dashboard exists but isn't load-bearing |
+| Pattern | What it usually means |
+| ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
+| Stripe-shaped `external_data_sources` row with `status = failed` or stuck `running` | Revenue dashboard silently stale — high-impact upstream watchdog |
+| Configured revenue event missing or sharply down in `top_events` | Capture regression — MRR / gross revenue dropping artificially |
+| `popular_insights` includes revenue chart and chart's source is unhealthy | Confirmed downstream impact — high-confidence finding |
+| `product_intents` lists revenue analytics but no Stripe source and `revenue_analytics_config.events` is empty | Stuck onboarding — write memory, don't report |
+| Recent revenue dashboard view counts unchanged after a known revenue movement | Team isn't watching — dashboard exists but isn't load-bearing |
### Explore
@@ -86,27 +128,35 @@ Cheap validation: `query-trends` on the event with a 14-day window — confirm t
High-confidence finding when:
- 14-day trend shows a clear inflection, not a normal weekly cycle.
-- Event still defined in `RevenueAnalyticsConfig` (team didn't intentionally rename it).
+- Event still in `revenue_analytics_config.events[].eventName` from `project-get` (team didn't intentionally rename it).
- Recent deploy / SDK upgrade timing matches the inflection (hint, not proof).
#### Subscription property missing → MRR is empty
-Event source configured for a subscription business, but `RevenueAnalyticsConfig.events[].subscriptionProperty` is null. The MRR view will be empty because PostHog can't tell which charges belong to the same subscription. The dashboard renders but only gross revenue is meaningful.
+Event source configured for a subscription business, but `revenue_analytics_config.events[].subscriptionProperty` from `project-get` is null. The MRR view will be empty because PostHog can't tell which charges belong to the same subscription. The dashboard renders but only gross revenue is meaningful.
-Detect: events configured with revenue + currency but no subscription property; gross-revenue chart populated, MRR chart empty. Scratchpad-level finding for new-onboarding teams; report-worthy if the team has been live long enough that they should have noticed.
+Detect: events configured with revenue + currency but no subscription property; gross-revenue chart populated, MRR chart empty. The managed-view fallback cannot show the property mapping, so do not report this finding without `project-get`. Scratchpad-level finding for new-onboarding teams; report-worthy if the team has been live long enough that they should have noticed.
#### Currency mix surprise
-`execute-sql` on `revenue_analytics.all.revenue_analytics_charge`:
+There is no cross-source charge view. List the charge view of every source:
+
+```sql
+SELECT table_name
+FROM system.information_schema.tables
+WHERE table_name LIKE '%.charge_revenue_view' OR table_name LIKE '%.charge_events_revenue_view'
+```
+
+Then run `execute-sql` on each charge view:
```sql
-SELECT original_currency, count(), sum(original_amount)
-FROM revenue_analytics.all.revenue_analytics_charge
+SELECT source_label, original_currency, count(), sum(original_amount)
+FROM <charge_view>
WHERE timestamp > now() - INTERVAL 30 DAY
-GROUP BY 1 ORDER BY 2 DESC
+GROUP BY 1, 2 ORDER BY 3 DESC
```
-A currency that's never appeared before, or whose share suddenly jumped, usually means either (a) the team is selling into a new market — write a scratchpad entry, no report, or (b) currency property is misconfigured and revenue is being mis-tagged. The (b) case shows up as a single dominant currency on a non-USD team or vice versa. Cross-reference with `RevenueAnalyticsEventItem.currencyProperty` to tell them apart.
+A currency that's never appeared before, or whose share suddenly jumped, usually means either (a) the team is selling into a new market — write a scratchpad entry, no report, or (b) currency property is misconfigured and revenue is being mis-tagged. The (b) case shows up as a single dominant currency on a non-USD team or vice versa. Read each `source_label` on its own, because `revenueCurrencyProperty` controls only event charges. For a `revenue_analytics.events.<event>` label, cross-reference that event's `revenue_analytics_config.events[].revenueCurrencyProperty` from `project-get` to tell them apart: `{static: "USD"}` tags every charge of that event with one currency, and `{property: ...}` reads it from the event. A warehouse label (e.g. `stripe.<prefix>`) takes its currency from the source's own data, so do not blame the event config for a shift there.
#### Stripe-customer ↔ PostHog-person join broken
@@ -118,15 +168,9 @@ Detect via the `customer` view: count of customers with non-null `posthog_person
Stripe source healthy, but invoice line items missing the `period` property. The dashboard will show monthly revenue lumpy (annual subscriptions land in one month) instead of spread across the service period. Check the `revenue_item` view: rows where `is_recurring = true` and `period_start` / `period_end` are null. Report when more than ~20% of recurring rows are missing period info — finance reporting wrong in a subtle way.
-#### Goal miss without escalation
-
-`RevenueAnalyticsConfig.goals` carries `due_date` + `goal` + `mrr_or_gross`. If a goal's `due_date` is < 14 days out and current MRR (or gross revenue) is trending under the goal, the team should already be reacting. If recent dashboard views haven't ticked up, they aren't watching. Surface the gap; let the team decide.
-
-Disqualifier: goals with `due_date` already past, where the team hasn't updated them — config debt, not active targets. Scratchpad entry, skip the report.
-
#### Test-account contamination
-`RevenueAnalyticsConfig.filter_test_accounts = false` on a project with a `person.properties.email` filter set up for test accounts. Internal QA charges are being counted as real revenue. Easy scratchpad entry; report-worthy if the scratchpad shows the team has historically asked about "revenue jumped overnight" incidents and the cause was QA traffic.
+`revenue_analytics_config.filter_test_accounts = false` (from `project-get`) on a project with configured revenue events and a `person.properties.email` filter set up for test accounts. Internal QA charges from those events are being counted as real revenue. The flag controls only event-source views, so it does not explain QA charges in a Stripe or other warehouse view, and turning it on does not remove them. Easy scratchpad entry; report-worthy if the scratchpad shows the team has historically asked about "revenue jumped overnight" incidents and the cause was QA traffic.
### Save memory as you go
@@ -135,7 +179,6 @@ Memory is a continuous activity. Write a scratchpad entry whenever you observe s
- key `pattern:revenue_analytics:event-config` — _"Revenue event is `purchase_completed`; revenue prop is `revenue` (cents), currency prop is `currency`, subscription prop is `subscription_id`."_
- key `pattern:revenue_analytics:stripe_prod` — _"Stripe source `stripe_prod` is the team's primary; `stripe_test` is sandbox and its failures are expected."_
- key `pattern:revenue_analytics:currency-mix` — _"Reporting currency is USD; `original_currency` regularly includes EUR / GBP / CAD — multi-currency mix is normal for this team."_
-- key `pattern:revenue_analytics:q3-arr-goal` — _"Team has revenue analytics goals configured; Q3 ARR target is $X by due_date 2026-09-30 — re-check progress monthly."_
- key `pattern:revenue_analytics:dashboard-staleness` — _"Revenue dashboard at `/revenue` was last viewed 2026-04-22; team isn't actively watching — report at a higher confidence threshold."_
- key `addressed:revenue_analytics:test-accounts` — _"`filter_test_accounts` is off; QA charges from `@example.com` accounts appear in revenue — already raised, team aware."_
- key `report:revenue_analytics:stripe_prod` — _"Authored report `0193…` for the stalled `stripe_prod` sync on 2026-06-30 (MRR + gross-revenue dashboards reading stale); edit it if the source is still failing next run."_
@@ -163,8 +206,7 @@ The harness prompt carries the full report-channel contract (field schema, safet
- **Reporting currency just changed** — apparent step-change in all charts; not a regression. A `pattern:` scratchpad entry from a prior run usually flags this.
- **Revenue analytics in beta on the team's plan** — some teams use it as preview-only. The scratchpad should record this; if no entry exists, write one and skip.
- **Sandbox / test Stripe source** — `prefix` like `test_` or `sandbox_` means the team is wiring up integration; failures here aren't production signal.
-- **Revenue event renamed by the team** — `RevenueAnalyticsConfig.events[].eventName` was updated recently; the "missing event" is the old name. Cross-check config recency before flagging.
-- **Goal expired with no follow-up** — config debt, not an active target. Scratchpad entry, skip.
+- **Revenue event removed or renamed by the team** — `revenue_analytics_config.events[].eventName` from `project-get` no longer lists the "missing" event. Treat a new event name as a rename only when prior-run memory or other evidence links it to the old name. A second configured event can be independent, so an old event that stays in the config is still in scope.
When in doubt, write a memory entry instead of authoring a report.
@@ -172,11 +214,12 @@ When in doubt, write a memory entry instead of authoring a report.
Direct calls (read-only):
+- `project-get` — call without `id`. `revenue_analytics_config.events[]` and `revenue_analytics_config.filter_test_accounts` are the team's revenue config. If it fails, use the managed-view fallback in [Read the revenue config](#read-the-revenue-config) and state its limits.
- `external-data-sources-list` / `external-data-sources-retrieve` — Stripe source health. Filter `source_type` to payment platforms.
- `external-data-sync-logs` — failure history; one-off vs recurring upstream issues.
- `read-data-schema events` / `read-data-schema event_properties` — confirm revenue event + properties still flow.
- `query-trends` — validate event-volume drops with a 14-day window and weekly comparison.
-- `execute-sql` against `revenue_analytics.all.revenue_analytics_<charge|customer|mrr|revenue_item|subscription>` — managed views are the source of truth. Per-source views also exist: `<source>.<prefix>.revenue_analytics_<view_type>` (data warehouse) and `revenue_analytics.events.<event_name>.revenue_analytics_<view_type>` (events).
+- `execute-sql` against the managed views, which are the source of truth. There is no cross-source view. Each source has its own views, where `<kind>` is `charge`, `customer`, `mrr`, `product`, `revenue_item`, or `subscription`: `<source>.<prefix>.<kind>_revenue_view` (data warehouse, `<prefix>.` is absent when the source has no prefix) and `revenue_analytics.events.<event_name>.<kind>_events_revenue_view` (events). List them from `system.information_schema.tables`.
- `execute-sql` against `system.insights` / `system.dashboards` — find revenue insights and dashboards that depend on a failing source (blast radius).
- `dashboards-get-all` / `dashboard-get` — the built-in revenue dashboard and any custom revenue dashboards.
- `health-issues-list` — platform-detected issues on warehouse sources, where revenue is one of the highest-priority downstream consumers. Pass `kind="external_data_failure"`, `status="active"` and `dismissed=false` on every call: the endpoint excludes nothing by default, so without all three you rank resolved rows and ones a human already waved off. It serves 50 rows by default (250 max) ordered severity-first, so read `count` and page with `offset` when it exceeds the rows you hold.
@@ -193,7 +236,7 @@ For deeper investigation, the sandbox image bakes `posthog:auditing-warehouse-so
## When to stop
-- No payment platform + no revenue event → close out empty (after writing the `not-in-use:` scratchpad entry).
+- No payment platform + empty `revenue_analytics_config.events` → close out empty (after writing the `not-in-use:` scratchpad entry).
- Profile + scratchpad show a stable picture → close out empty.
- A candidate matches a scratchpad entry with `noise:` / `addressed:` / `dedupe:` key prefix → skip.
- You've validated some hypotheses and authored or edited what's solid → close out, even if there's more you could look at. Fewer, better reports — especially here, where panic radius is high.