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-annotations.md

Annotations

Annotation (system.annotations)

Annotations are timestamped notes used to mark product changes, incidents, or releases directly on charts.

Columns

Column | Type | Nullable | Description --- | --- | --- | --- id | Integer | NOT NULL | Annotation id. team_id | Integer | NOT NULL | content | String | NULL | Annotation text. scope | String | NOT NULL | Where the annotation applies: 'project', 'organization', 'dashboard', 'dashboard_item' (insight), or 'recording'. creation_type | String | NOT NULL | How the annotation was created, e.g. user-created vs GitHub. date_marker | DateTime | NULL | The point in time the annotation marks on a chart. deleted | Integer | NOT NULL | 1 if the annotation has been deleted, 0 otherwise. dashboard_item_id | Integer | NULL | Insight this annotation is scoped to; joins to insights.id. dashboard_id | Integer | NULL | Dashboard this annotation is scoped to; joins to dashboards.id. created_by_id | Integer | NULL | User who created the annotation. created_at | DateTime | NULL | When the annotation was created. updated_at | DateTime | NOT NULL | When the annotation was last updated.

Key Relationships

  • Insights: dashboard_item_id -> system.insights.id
  • Dashboards: dashboard_id -> system.dashboards.id

Important Notes

  • The API usually hides deleted=true rows; SQL queries should filter them explicitly when needed.
  • scope='organization' annotations can appear across multiple projects in the same organization.

Common Query Patterns

List recent non-deleted annotations:

SELECT id, scope, content, date_marker, created_at
FROM system.annotations
WHERE NOT deleted
ORDER BY date_marker DESC NULLS LAST
LIMIT 100

Find annotations around a release window:

SELECT id, content, scope, date_marker
FROM system.annotations
WHERE NOT deleted
  AND date_marker >= toDateTime('2026-03-01 00:00:00')
  AND date_marker < toDateTime('2026-03-08 00:00:00')
ORDER BY date_marker ASC

Get organization-scoped annotations only:

SELECT id, content, date_marker, created_by_id
FROM system.annotations
WHERE NOT deleted
  AND scope = 'organization'
ORDER BY date_marker DESC NULLS LAST