AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

querying-posthog-data

Explains how to query PostHog data, defaulting to typed runners for supported product analytics. Read it before you write HogQL/SQL. Also read it before you call execute-sql against PostHog. Use it to find or aggregate PostHog entities. These entities include insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, warehouse data, and persons. Use it for trends, funnels, retention, lifecycle, paths, stickiness, web analytics, error tracking, logs, sessions, and LLM traces. Before you calculate a governed business or telemetry measure, check system.information_schema.metrics for an approved definition. Examples include MRR, activation, billable usage, active organizations, and failure rates. Use the approved definition before you derive a measure from raw events or use a typed domain tool. It also covers HogQL differences, system table schemas, functions, query examples, and schema discovery.

Original source
posthog
License
MIT
Pinned revision
cac7c80a9e5b73484d18eda1bffb47297c938e0c

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read posthog--querying-posthog-data at revision cac7c80a9e5b73484d18eda1bffb47297c938e0c, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 65

references/models-replay-vision.md

Replay Vision

Replay Vision runs LLM scanners over session recordings. A scanner watches a slice of recordings and records one observation per session it scans. Observations land as $recording_observed events, so query findings from events, and query scanner configuration from the table below.

ReplayScanner (system.replay_scanners)

One row per saved scanner. One-off inline scans are not listed.

Columns

Column | Type | Nullable | Description --- | --- | --- | --- id | UUID | NOT NULL | Scanner UUID. Cast with toString(id) to join on a string property such as scanner_id. team_id | Integer | NOT NULL | name | String | NOT NULL | Scanner name, unique within the project. description | String | NOT NULL | Free-text description; blank when unset. scanner_type | String | NOT NULL | One of monitor, classifier, scorer, summarizer. scanner_config | JSON | NOT NULL | Type-specific JSON config; always includes the prompt. query | JSON | NOT NULL | JSON RecordingsQuery selecting the sessions the scanner watches. sampling_rate | Float | NOT NULL | Random share of matching sessions scanned, 0 to 1. sampling_mode | String | NOT NULL | Quality pre-filter: focused, balanced or comprehensive. model | String | NOT NULL | LLM model that scans each session; sets the price. enabled | Integer | NOT NULL | 1 when the scanner sweeps new recordings on schedule, 0 otherwise. emits_signals | Integer | NOT NULL | 1 when findings are also pushed into the Signals inbox, 0 otherwise. scanner_version | Integer | NOT NULL | Config version, bumped on every config edit. credit_limit | Integer | NULL | Per-period credit cap for this scanner (NULL when uncapped). estimated_monthly_observations | Integer | NULL | Last projection of observations per month (NULL before the first estimate). last_swept_at | DateTime | NULL | When the scheduled sweep last ran (NULL before it has). created_by_id | Integer | NULL | User who created the scanner (NULL when deleted). created_at | DateTime | NOT NULL | When the scanner was created. updated_at | DateTime | NOT NULL | When the scanner was last modified.

Key Relationships

  • $recording_observed events carry the scanner as properties.scanner_id and the recording as properties.session_id

To join scanners to their observations, cast the UUID id, since properties.scanner_id is a string:

SELECT s.name, count() AS observations
FROM events e
JOIN system.replay_scanners s ON toString(s.id) = e.properties.scanner_id
WHERE e.event = '$recording_observed' AND e.timestamp > now() - INTERVAL 7 DAY
GROUP BY s.name
ORDER BY observations DESC

Important Notes

  • Alerts and backfills are not system tables, because their API checks permissions a system table cannot. Read them with vision-alerts-list and vision-scanners-backfills-list.