: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
fix(posthog-ai): convert remaining schema references to generated column tables (#84280)
Sam Penningtonf0b45c9ea2a2
diff --git a/products/posthog_ai/scripts/schema_columns/test/test_schema_columns.py b/products/posthog_ai/scripts/schema_columns/test/test_schema_columns.pyindex 26ba940c4289..8e146aacc72a 100644--- a/products/posthog_ai/scripts/schema_columns/test/test_schema_columns.py+++ b/products/posthog_ai/scripts/schema_columns/test/test_schema_columns.py@@ -1,9 +1,33 @@from __future__ import annotations+import re+from pathlib import Path+import pytest+from products.posthog_ai.scripts.build_skills import SkillRendererfrom products.posthog_ai.scripts.schema_columns import schema_columns+REFERENCES = Path(__file__).resolve().parents[3] / "skills" / "querying-posthog-data" / "references"++# A four-column row (`col` | type | nullable | description) is a schema table. The two-column+# `field` | description tables in these docs describe nested JSON, not columns.+HAND_WRITTEN_COLUMN_ROW = re.compile(r"^`[^`]+`\s*\|.*\|.*\|")+++def test_model_references_render_without_hand_written_columns() -> None:+ renderer = SkillRenderer()+ paths = sorted(REFERENCES.glob("models-*.md.j2"))+ assert paths, f"no model reference templates found in {REFERENCES}"++ for path in paths:+ renderer.render(path) # raises if a referenced table no longer exists in the catalog+ offenders = [line for line in path.read_text().splitlines() if HAND_WRITTEN_COLUMN_ROW.match(line)]+ assert not offenders, (+ f"{path.name} hand-writes column rows instead of calling schema_columns(): {offenders[:3]}. "+ "Columns drift out of sync with HogQL when copied from the Django models."+ )+def test_unknown_table_raises() -> None:with pytest.raises(ValueError, match="system.not_a_table"):@@ -20,3 +44,43 @@ def test_renders_only_columns_hogql_exposes() -> None:# Django-model fields HogQL does not expose, which the docs used to advertise.for absent in ("is_sample", "derived_name", "filters_hash", "refreshing"):assert absent not in rendered+++def test_renders_session_recording_nullability() -> None:+ rendered = schema_columns("system.session_recordings")++ for column in (+ "distinct_id",+ "duration",+ "active_seconds",+ "inactive_seconds",+ "start_time",+ "end_time",+ "click_count",+ "keypress_count",+ "mouse_activity_count",+ "console_log_count",+ "console_warn_count",+ "console_error_count",+ "start_url",+ "deleted",+ "created_at",+ "retention_period_days",+ "storage_version",+ ):+ assert f"`{column}` | " in rendered+ assert (+ next(line for line in rendered.splitlines() if line.startswith(f"`{column}` | ")).split(" | ")[2]+ == "NOT NULL"+ )+++def test_renders_usage_metric_contract() -> None:+ rendered = schema_columns("system.usage_metrics")++ assert (+ "`group_type_index` | Integer | NOT NULL | Legacy; the query runner ignores it and evaluates every metric regardless. Don't filter on it."+ in rendered+ )+ assert "`format` | String | NOT NULL | Display format: 'numeric' or 'currency'." in rendered+ assert "`math` | String | NOT NULL | Aggregation: 'count' or 'sum'; 'sum' aggregates math_property." in rendereddiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-actions.md b/products/posthog_ai/skills/querying-posthog-data/references/models-actions.md.j2similarity index 62%rename from products/posthog_ai/skills/querying-posthog-data/references/models-actions.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-actions.md.j2index 7028bbc2a115..99ad7f72e314 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-actions.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-actions.md.j2@@ -6,23 +6,7 @@ Actions are named combinations of events and conditions used for filtering and a### Columns-Column | Type | Nullable | Description-`id` | integer | NOT NULL | Primary key (auto-generated)-`name` | varchar(400) | NULL | Action name-`description` | text | NOT NULL | Action description-`deleted` | boolean | NOT NULL | Soft delete flag-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`steps_json` | jsonb | NULL | Action step definitions-`post_to_slack` | boolean | NOT NULL | Whether to post matches to Slack-`slack_message_format` | varchar(1200) | NOT NULL | Slack message template-`is_calculating` | boolean | NOT NULL | Whether calculation is in progress-`last_calculated_at` | timestamp with tz | NOT NULL | Last calculation timestamp-`bytecode` | jsonb | NULL | Compiled action bytecode-`bytecode_error` | text | NULL | Compilation error message-`pinned_at` | timestamp with tz | NULL | When action was pinned-`summary` | text | NULL | AI-generated summary-`created_by_id` | integer | NULL | Creator user ID+{{ schema_columns('system.actions') }}### Steps JSON Structure@@ -64,7 +48,6 @@ Field | Description- Actions can combine multiple event conditions (steps)- Steps are OR'd together - matching any step triggers the action-- `bytecode` is compiled from steps for efficient evaluation- Actions can be used in insights, cohorts, and feature flag targeting---diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-activity-logs.md b/products/posthog_ai/skills/querying-posthog-data/references/models-activity-logs.md.j2similarity index 78%rename from products/posthog_ai/skills/querying-posthog-data/references/models-activity-logs.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-activity-logs.md.j2index 6ea514d5301e..9b33172f8398 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-activity-logs.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-activity-logs.md.j2@@ -8,14 +8,7 @@ Activity logs track user and system actions across PostHog entities, providing a### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key (auto-generated UUID)-`team_id` | integer | NULL | Team the activity belongs to-`activity` | varchar(79) | NOT NULL | Action performed (e.g., `created`, `updated`, `deleted`)-`item_id` | varchar(72) | NULL | ID of the entity being logged (may be numeric ID, short ID, or UUID)-`scope` | varchar(79) | NOT NULL | Entity type being logged (e.g., `FeatureFlag`, `Insight`)-`detail` | jsonb | NULL | Structured details about the change-`created_at` | timestamp with tz | NOT NULL | When the activity occurred+{{ schema_columns('system.activity_logs') }}### Detail JSON Structurediff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-evaluations.md b/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-evaluations.mddeleted file mode 100644index e8d48a210166..000000000000--- a/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-evaluations.md+++ /dev/null@@ -1,77 +0,0 @@-# AI observability evaluations--## Evaluation directory (`system.evaluation_directories`)--Evaluation directories organize online evaluations. Directories are flat. An evaluation with no directory is at the top level.--### Columns--Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Directory UUID-`team_id` | integer | NOT NULL | Owning team-`name` | varchar(400) | NOT NULL | Directory name-`created_by_id` | integer | NULL | User who created the directory-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NULL | Last update timestamp--## Evaluation (`system.evaluations`)--Online evaluations score AI generations or traces. Evaluation results are stored as `$ai_evaluation` events, not on this configuration table.--### Columns--Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Evaluation UUID-`team_id` | integer | NOT NULL | Owning team-`directory_id` | uuid | NULL | FK to `system.evaluation_directories.id`; NULL means the top level-`name` | varchar(400) | NOT NULL | Evaluation name-`description` | text | NOT NULL | Evaluation description-`enabled` | boolean | NOT NULL | Whether the evaluation is active-`status` | varchar(20) | NOT NULL | Current evaluation status-`status_reason` | varchar(50) | NULL | Reason for the current status, when available-`evaluation_type` | varchar(50) | NOT NULL | Evaluation implementation type-`evaluation_config` | jsonb | NOT NULL | Evaluation-specific configuration-`output_type` | varchar(50) | NOT NULL | Evaluation result type-`output_config` | jsonb | NOT NULL | Evaluation output configuration-`conditions` | jsonb | NOT NULL | Conditions that select matching input-`target` | varchar(20) | NOT NULL | Unit evaluated, such as a generation or trace-`target_config` | jsonb | NOT NULL | Target-specific configuration-`model_configuration_id` | uuid | NULL | Model configuration used by an LLM judge evaluation-`created_by_id` | integer | NULL | User who created the evaluation-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`deleted` | boolean | NOT NULL | Whether the evaluation has been deleted--### Important notes--- Filter on `deleted = false` to match the default online evals list.-- Use `directory_id IS NULL` for evaluations at the top level.-- Deleting a directory preserves its evaluations and sets their `directory_id` to NULL.--## Common query patterns--**List directories with active evaluation counts:**--```sql-SELECT- d.id,- d.name,- count(e.id) AS evaluation_count-FROM system.evaluation_directories AS d-LEFT JOIN system.evaluations AS e- ON e.directory_id = d.id- AND e.deleted = false-GROUP BY d.id, d.name-ORDER BY d.name ASC-```--**List active evaluations at the top level:**--```sql-SELECT id, name, evaluation_type, status, updated_at-FROM system.evaluations-WHERE deleted = false- AND directory_id IS NULL-ORDER BY updated_at DESC-LIMIT 100-```diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-evaluations.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-evaluations.md.j2new file mode 100644index 000000000000..e1cb6cc7b2b4--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-evaluations.md.j2@@ -0,0 +1,51 @@+# AI observability evaluations++## Evaluation directory (`system.evaluation_directories`)++Evaluation directories organize online evaluations. Directories are flat. An evaluation with no directory is at the top level.++### Columns++{{ schema_columns('system.evaluation_directories') }}++## Evaluation (`system.evaluations`)++Online evaluations score AI generations or traces. Evaluation results are stored as `$ai_evaluation` events, not on this configuration table.++### Columns++{{ schema_columns('system.evaluations') }}++### Important notes++- Filter on `deleted = false` to match the default online evals list.+- Use `directory_id IS NULL` for evaluations at the top level.+- Deleting a directory preserves its evaluations and sets their `directory_id` to NULL.++## Common query patterns++**List directories with active evaluation counts:**++```sql+SELECT+ d.id,+ d.name,+ count(e.id) AS evaluation_count+FROM system.evaluation_directories AS d+LEFT JOIN system.evaluations AS e+ ON e.directory_id = d.id+ AND e.deleted = false+GROUP BY d.id, d.name+ORDER BY d.name ASC+```++**List active evaluations at the top level:**++```sql+SELECT id, name, evaluation_type, status, updated_at+FROM system.evaluations+WHERE deleted = false+ AND directory_id IS NULL+ORDER BY updated_at DESC+LIMIT 100+```diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-reviews.md b/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-reviews.md.j2similarity index 54%rename from products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-reviews.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-reviews.md.j2index 3c3c7d02c132..c10c85149deb 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-reviews.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-ai-observability-reviews.md.j2@@ -7,17 +7,7 @@ Each active trace can have at most one active review at a time.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Owning team-`trace_id` | varchar(255) | NOT NULL | Reviewed LLM trace ID-`created_by_id` | integer | NULL | User ID that originally created the review-`reviewed_by_id` | integer | NULL | User ID that last saved the review-`comment` | text | NULL | Optional comment attached to the review-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NULL | Last save timestamp-`deleted` | integer | NULL | Soft-delete flag (`0` = active, `1` = deleted)-`deleted_at` | timestamp with tz | NULL | When the review was soft-deleted+{{ schema_columns('system.trace_reviews') }}### Key relationships@@ -33,20 +23,7 @@ Each row captures one scorer definition and exactly one value type.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Owning team-`review_id` | uuid | NOT NULL | FK to `system.trace_reviews.id`-`definition_id` | uuid | NOT NULL | Stable scorer definition ID-`definition_version` | uuid | NOT NULL | Immutable scorer version ID used when saving the score-`definition_version_number` | integer | NOT NULL | Immutable scorer version number used when saving the score-`definition_config` | jsonb | NOT NULL | Snapshot of the scorer configuration used for validation-`categorical_values` | array(varchar) | NULL | Selected categorical option keys-`numeric_value` | decimal(12,6) | NULL | Saved numeric score-`boolean_value` | boolean | NULL | Saved boolean score-`created_by_id` | integer | NULL | User ID that created the score row-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NULL | Last update timestamp+{{ schema_columns('system.trace_review_scores') }}### Important notes@@ -61,15 +38,7 @@ Review queues are named buckets used to route traces that still need review.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Owning team-`name` | varchar(255) | NOT NULL | Display name for the queue-`created_by_id` | integer | NULL | User ID that created the queue-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NULL | Last update timestamp-`deleted` | integer | NULL | Soft-delete flag (`0` = active, `1` = deleted)-`deleted_at` | timestamp with tz | NULL | When the queue was soft-deleted+{{ schema_columns('system.review_queues') }}### Key relationships@@ -84,16 +53,7 @@ An active trace can only be pending in one queue at a time.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Owning team-`queue_id` | uuid | NOT NULL | FK to `system.review_queues.id`-`trace_id` | varchar(255) | NOT NULL | Pending LLM trace ID-`created_by_id` | integer | NULL | User ID that queued the trace-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NULL | Last update timestamp-`deleted` | integer | NULL | Soft-delete flag (`0` = active, `1` = deleted)-`deleted_at` | timestamp with tz | NULL | When the queue item was soft-deleted+{{ schema_columns('system.review_queue_items') }}### Important notes@@ -109,17 +69,7 @@ Each scorer has a stable identity but config is versioned and immutable — bump### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Stable scorer ID-`team_id` | integer | NOT NULL | Owning team-`name` | varchar(255) | NOT NULL | Display name-`description` | text | NOT NULL | Optional description (defaults to empty string)-`kind` | varchar(32) | NOT NULL | One of `categorical`, `numeric`, `boolean`. Immutable after creation-`archived` | boolean | NOT NULL | Whether the scorer is archived (hidden from default lists)-`current_version_id` | uuid | NULL | FK to the latest `score_definition_versions` row (config + version number)-`created_by_id` | integer | NULL | User ID that created the scorer-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NULL | Last metadata update timestamp+{{ schema_columns('system.score_definitions') }}### Key relationshipsdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-alerts.md b/products/posthog_ai/skills/querying-posthog-data/references/models-alerts.mddeleted file mode 100644index 163de97c3a73..000000000000--- a/products/posthog_ai/skills/querying-posthog-data/references/models-alerts.md+++ /dev/null@@ -1,42 +0,0 @@-# Alerts--## AlertConfiguration (`system.alerts`)--Alerts monitor insight values and notify subscribed users when thresholds are breached.--### Columns--Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Team this alert belongs to-`name` | varchar(255) | NOT NULL | Human-readable alert name (can be blank)-`insight_id` | integer | NOT NULL | FK to the insight being monitored-`enabled` | boolean | NOT NULL | Whether the alert is actively evaluated-`state` | varchar(10) | NOT NULL | `Firing`, `Not firing`, `Errored`, or `Snoozed`-`calculation_interval` | varchar(20) | NULL | Check frequency: `real_time`, `every_15_minutes`, `hourly`, `daily`, `weekly`, or `monthly`-`condition` | jsonb | NOT NULL | Alert condition: `{"type": "absolute_value" | "relative_increase" | "relative_decrease"}`-`config` | jsonb | NULL | Trends config: `{"type": "TrendsAlertConfig", "series_index": int, "check_ongoing_interval": bool}`-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`last_notified_at` | timestamp with tz | NULL | When subscribers were last notified-`last_checked_at` | timestamp with tz | NULL | When the alert was last evaluated-`next_check_at` | timestamp with tz | NULL | When the next evaluation is scheduled-`snoozed_until` | timestamp with tz | NULL | Snooze expiry (UTC)-`skip_weekend` | boolean | NULL | Whether to skip evaluation on Saturday and Sunday--### Key Relationships--- Each alert monitors exactly one **Insight** (`insight_id` → `system.insights.id`)-- Alerts belong to a **Team** (`team_id`)-- Subscribers are managed via `AlertSubscription` (not exposed as a system table)--### Important Notes--- The `condition.type` determines evaluation mode:- - `absolute_value` — fires when the value crosses the threshold bounds- - `relative_increase` — fires when the value increases beyond the threshold- - `relative_decrease` — fires when the value decreases beyond the threshold-- The `config.series_index` selects which series in a multi-series insight to monitor-- `real_time` requires a Scale or Enterprise plan-- `every_15_minutes` requires a Boost, Scale, or Enterprise add-on-- Creating or updating alerts through MCP requires the `alert:write` scope. Reconnect the MCP connection if these tools are unavailable-- Alerts have a per-team limit (2 on the free tier, higher on paid plans)diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-alerts.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-alerts.md.j2new file mode 100644index 000000000000..40a17cc28eab--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-alerts.md.j2@@ -0,0 +1,27 @@+# Alerts++## AlertConfiguration (`system.alerts`)++Alerts monitor insight values and notify subscribed users when thresholds are breached.++### Columns++{{ schema_columns('system.alerts') }}++### Key Relationships++- Each alert monitors exactly one **Insight** (`insight_id` → `system.insights.id`)+- Alerts belong to a **Team** (`team_id`)+- Subscribers are managed via `AlertSubscription` (not exposed as a system table)++### Important Notes++- The `condition.type` determines evaluation mode:+ - `absolute_value` — fires when the value crosses the threshold bounds+ - `relative_increase` — fires when the value increases beyond the threshold+ - `relative_decrease` — fires when the value decreases beyond the threshold+- The `config.series_index` selects which series in a multi-series insight to monitor+- `real_time` requires a Scale or Enterprise plan+- `every_15_minutes` requires a Boost, Scale, or Enterprise add-on+- Creating or updating alerts through MCP requires the `alert:write` scope. Reconnect the MCP connection if these tools are unavailable+- Alerts have a per-team limit (2 on the free tier, higher on paid plans)diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-annotations.md b/products/posthog_ai/skills/querying-posthog-data/references/models-annotations.md.j2similarity index 58%rename from products/posthog_ai/skills/querying-posthog-data/references/models-annotations.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-annotations.md.j2index e2ca4db586e3..5cfd40e4fc14 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-annotations.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-annotations.md.j2@@ -6,19 +6,7 @@ Annotations are timestamped notes used to mark product changes, incidents, or re### Columns-Column | Type | Nullable | Description-`id` | integer | NOT NULL | Primary key (auto-generated)-`team_id` | integer | NOT NULL | Project/team ID for isolation-`content` | varchar(8192) | NULL | Annotation text content-`scope` | varchar(24) | NOT NULL | Annotation scope: `project`, `organization`, `dashboard`, `dashboard_item`, `recording`-`creation_type` | varchar(3) | NOT NULL | Creation source: `USR` (user) or `GIT` (GitHub/bot)-`date_marker` | timestamp with tz | NULL | Timestamp shown on charts-`deleted` | boolean | NOT NULL | Soft delete flag-`dashboard_item_id` | integer | NULL | Linked insight ID (if scoped to insight)-`dashboard_id` | integer | NULL | Linked dashboard ID (if scoped to dashboard)-`created_by_id` | integer | NULL | Creator user ID-`created_at` | timestamp with tz | NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp+{{ schema_columns('system.annotations') }}### Key Relationshipsdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-cohorts.md b/products/posthog_ai/skills/querying-posthog-data/references/models-cohorts.md.j2similarity index 68%rename from products/posthog_ai/skills/querying-posthog-data/references/models-cohorts.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-cohorts.md.j2index 9fbe4002cb3c..69918ea33b75 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-cohorts.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-cohorts.md.j2@@ -6,24 +6,7 @@ Cohorts are groups of persons used for segmentation and targeting.### Columns-Column | Type | Nullable | Description-`id` | integer | NOT NULL | Primary key (auto-generated)-`name` | varchar(400) | NULL | Cohort display name-`description` | varchar(1000) | NOT NULL | Cohort description-`deleted` | boolean | NOT NULL | Soft delete flag-`filters` | jsonb | NULL | Modern filter structure for cohort criteria-`query` | jsonb | NULL | HogQL query for analytical cohorts-`version` | integer | NULL | Current calculation version-`pending_version` | integer | NULL | Version being calculated-`count` | integer | NULL | Cached person count-`created_at` | timestamp with tz | NULL | Creation timestamp-`is_calculating` | boolean | NOT NULL | Whether calculation is in progress-`last_calculation` | timestamp with tz | NULL | Timestamp of last successful calculation-`errors_calculating` | integer | NOT NULL | Consecutive error count-`last_error_at` | timestamp with tz | NULL | Timestamp of last calculation error-`is_static` | boolean | NOT NULL | Static (manually uploaded) vs dynamic cohort-`cohort_type` | varchar(50) | NULL | One of: `static`, `person_property`, `behavioral`, `realtime`, `analytical`-`created_by_id` | integer | NULL | Creator user ID+{{ schema_columns('system.cohorts') }}### Cohort Types@@ -114,16 +97,7 @@ Audit trail for cohort calculation jobs.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`filters` | jsonb | NOT NULL | Cohort filters at calculation time-`count` | integer | NULL | Number of persons in cohort (>= 0)-`started_at` | timestamp with tz | NOT NULL | Calculation start time-`finished_at` | timestamp with tz | NULL | Calculation end time (NULL = in progress)-`queries` | jsonb | NULL | Array of query statistics-`error` | text | NULL | Full error message if failed-`error_code` | varchar(64) | NULL | Categorized error code-`cohort_id` | integer | NOT NULL | FK to `system.cohorts.id`+{{ schema_columns('system.cohort_calculation_history') }}### Error Codes@@ -168,7 +142,7 @@ system.cohorts (main cohort definition)**Find cohorts by name:**```sql-SELECT id, name, count, cohort_type, is_static+SELECT id, name, count, is_staticFROM system.cohortsWHERE name ILIKE '%paying%' AND NOT deleted```diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md.j2new file mode 100644index 000000000000..b05e24913b2f--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md.j2@@ -0,0 +1,205 @@+# Customer analytics accounts and feature requests++Customer analytics tracks **accounts**, their owners and custom properties, and the feature requests linked to those accounts.++**Source of truth for account ownership questions** ("who is the CSM of X?", "which accounts does Y own?"): answer them from these tables, not from warehouse CRM columns (`salesforce.*`, `hubspot.*`, ...). Warehouse copies of ownership fields can lag behind reassignments made in PostHog.++Prefer the typed `posthog:accounts-*`, `posthog:account-relationship-definitions-*`, `posthog:custom-property-definitions-*`, and `posthog:feature-request*` MCP tools for writes. Use HogQL for reads and aggregations.++## Account (`system.accounts`)++One row per account.++### Columns++{{ schema_columns('system.accounts') }}++Lazy-joined fields:++- `tags.names`: tag names.+- `notebooks.count`: number of linked internal notes.+- `custom_properties.values`: current values keyed by immutable definition ID.+- `custom_properties_history.values`: numeric value history keyed by immutable definition ID.+- `relationships.values`: active user IDs keyed by immutable relationship-definition ID.+- `meetings`: meeting count, latest start time, and the newest 10 meeting summaries.+- `slack_summaries`: summary count, latest generation time, and the newest 10 Slack summaries.+- `feature_requests`: active request count, latest update time, and the newest 10 linked requests.+- `support_tickets`: ticket count, latest message time, and the newest 10 linked tickets. Requires ticket access.+- `email_threads`: thread count, latest message time, and the newest 10 linked email threads. Requires ticket access.++The `recent` fields are JSON arrays. They hold at most 10 records, newest first. Use the top-level tables when you need complete history.++## Account relationships (`system.account_relationship_definitions`, `system.account_relationships`)++A **relationship definition** is a team-defined relationship type between a PostHog user and an account — CSM (customer success manager), Account executive, Onboarding manager, and so on. An **account relationship** is one assignment of a user to an account for a definition, with its effective range.++### `system.account_relationship_definitions` columns++{{ schema_columns('system.account_relationship_definitions') }}++### `system.account_relationships` columns++{{ schema_columns('system.account_relationships') }}++### Important notes++- Active assignments are `ended_at IS NULL`; ended rows are kept as history.+- Do not read `csm`, `account_executive`, or `account_owner` from `system.accounts.properties`. These keys are retired, and the relationship backfill removes them. Use `system.account_relationships` for ownership.+- `system.account_relationships` exposes `user_id`, but the customer analytics HogQL system tables do not expose a current user email field. Use an account API when current organization member details are required.++## Feature requests++A feature request records a customer need across one or more accounts. Evidence belongs to a specific request and account pair. Product areas categorize requests, and history records each successful save.++The tables apply account access rules. `system.feature_requests` includes a request when the caller can access at least one active linked account. The account links and evidence tables exclude inaccessible and unlinked accounts.++### `system.feature_requests` columns++{{ schema_columns('system.feature_requests') }}++### `system.feature_request_account_links` columns++One row per active request and account pair visible to the caller.++{{ schema_columns('system.feature_request_account_links') }}++### `system.feature_request_evidence` columns++{{ schema_columns('system.feature_request_evidence') }}++### Product area tables++`system.feature_request_product_areas` defines the available areas. `system.feature_request_product_area_links` joins visible requests to those areas.++#### `system.feature_request_product_areas` columns++{{ schema_columns('system.feature_request_product_areas') }}++#### `system.feature_request_product_area_links` columns++{{ schema_columns('system.feature_request_product_area_links') }}++### `system.feature_request_history` columns++{{ schema_columns('system.feature_request_history') }}++### Feature request query patterns++**List active requests and their affected accounts:**++```sql+SELECT r.id, r.title, r.status, r.priority, a.id AS account_id, a.name AS account_name+FROM system.feature_requests r+JOIN system.feature_request_account_links l ON l.feature_request_id = r.id+JOIN system.accounts a ON a.id = l.account_id+WHERE r.archived_at IS NULL+ORDER BY r.updated_at DESC+```++**Count evidence items by request and account:**++```sql+SELECT r.title, a.name AS account_name, count(e.id) AS evidence_count+FROM system.feature_requests r+JOIN system.feature_request_account_links l ON l.feature_request_id = r.id+JOIN system.accounts a ON a.id = l.account_id+LEFT JOIN system.feature_request_evidence e ON e.account_link_id = l.id+GROUP BY r.id, r.title, a.id, a.name+ORDER BY evidence_count DESC+```++**List requests for one product area:**++```sql+SELECT r.id, r.title, r.status, p.name AS product_area+FROM system.feature_requests r+JOIN system.feature_request_product_area_links l ON l.feature_request_id = r.id+JOIN system.feature_request_product_areas p ON p.id = l.product_area_id+WHERE p.name ILIKE '%analytics%'+ORDER BY r.updated_at DESC+```++## Custom properties (`system.custom_property_definitions`)++Custom properties let a team attach typed attributes to accounts. A **definition** is the attribute's shape (its name and how it is typed and rendered); the per-account **values** are queried through `system.accounts` (see below). Definitions are team-scoped — one set per team, shared across all accounts.++### Columns++{{ schema_columns('system.custom_property_definitions') }}++### Important notes++- `is_big_number` surfaces as an integer (`0`/`1`), not a boolean.+- `display_type` is the rendering hint; effective data type is string for `text`, numeric for `number`/`currency`/`percent`, datetime for `date`/`datetime`, and boolean for `boolean`.++### Reading per-account values (`system.accounts.custom_properties`)++There is no standalone values table. An account's current value for a definition is read through a lazy join on `system.accounts`, keyed by the definition's `id`:++```text+accounts.custom_properties.values.`<definition_id>`+```++The `<definition_id>` is a `system.custom_property_definitions.id` (backtick-quoted, since it is a UUID). Only the current value is returned. Superseded values are excluded. The immutable ID keeps saved queries working when a property name changes.++## Common query patterns++**Who is the CSM (or any relationship holder) of an account:**++```sql+SELECT a.name, d.name AS relationship, r.user_id, r.started_at+FROM system.account_relationships r+JOIN system.account_relationship_definitions d ON d.id = r.definition_id+JOIN system.accounts a ON a.id = r.account_id+WHERE a.name ILIKE '%acme%'+ AND d.name = 'CSM'+ AND r.ended_at IS NULL+```++Do not use `properties.csm.email` as an email shortcut. The role keys in account properties are retired and are stripped by `backfill_account_relationships`. HogQL relationship tables return `user_id`; use an account API when current organization member details are required.++**All accounts a user holds a relationship on:**++```sql+SELECT a.name, d.name AS relationship+FROM system.account_relationships r+JOIN system.account_relationship_definitions d ON d.id = r.definition_id+JOIN system.accounts a ON a.id = r.account_id+WHERE r.user_id = 12345 AND r.ended_at IS NULL+ORDER BY a.name+```++**Assignment history of an account (including ended assignments):**++```sql+SELECT d.name AS relationship, r.user_id, r.started_at, r.ended_at+FROM system.account_relationships r+JOIN system.account_relationship_definitions d ON d.id = r.definition_id+WHERE r.account_id = '0192f000-0000-7000-8000-000000000000'+ORDER BY r.started_at DESC+```++**List all custom property definitions for a team:**++```sql+SELECT id, name, display_type, is_big_number+FROM system.custom_property_definitions+ORDER BY name+```++**Find numeric definitions:**++```sql+SELECT id, name, display_type+FROM system.custom_property_definitions+WHERE display_type IN ('number', 'currency', 'percent')+ORDER BY name+```++**Read a specific custom property value across accounts** (substitute a real definition id from the query above):++```sql+SELECT id, name, custom_properties.values.`0192f000-0000-7000-8000-000000000000` AS plan_tier+FROM system.accounts+ORDER BY name+```diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-data-warehouse.md b/products/posthog_ai/skills/querying-posthog-data/references/models-data-warehouse.md.j2similarity index 64%rename from products/posthog_ai/skills/querying-posthog-data/references/models-data-warehouse.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-data-warehouse.md.j2index 5cb888d5a165..9340dab58cb4 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-data-warehouse.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-data-warehouse.md.j2@@ -6,20 +6,7 @@ External data sources represent connections to third-party data providers (Strip### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`source_id` | varchar(400) | NOT NULL | External identifier for the source-`connection_id` | varchar(400) | NOT NULL | Connection identifier-`destination_id` | varchar(400) | NULL | Destination identifier-`source_type` | varchar(128) | NOT NULL | Type of source (Stripe, Hubspot, Postgres, etc.)-`status` | varchar(400) | NOT NULL | Current sync status-`prefix` | varchar(100) | NULL | Prefix applied to synced table names-`description` | varchar(400) | NULL | User-defined description-`are_tables_created` | boolean | NOT NULL | Whether tables have been created-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`deleted` | boolean | NOT NULL | Soft delete flag-`deleted_at` | timestamp with tz | NULL | Deletion timestamp+{{ schema_columns('system.data_warehouse_sources') }}### Source Types@@ -47,16 +34,7 @@ Individual tables synced from external sources or manually uploaded. Each table### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`name` | varchar(128) | NOT NULL | Table name (may include prefix)-`columns` | jsonb | NULL | Column definitions with types-`row_count` | integer | NULL | Number of rows synced-`external_data_source_id` | uuid | NULL | FK to source-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`deleted` | boolean | NOT NULL | Soft delete flag-`deleted_at` | timestamp with tz | NULL | Deletion timestamp+{{ schema_columns('system.data_warehouse_tables') }}### Columns JSON Structure@@ -103,20 +81,7 @@ Each schema represents one table or entity being synced from an external source.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`name` | varchar(400) | NOT NULL | Schema/table name (e.g., `customers`, `invoices`)-`source_id` | uuid | NOT NULL | FK to `system.data_warehouse_sources.id`-`table_id` | uuid | NULL | FK to `system.data_warehouse_tables.id`-`should_sync` | boolean | NOT NULL | Whether this schema is enabled for syncing-`status` | varchar(400) | NULL | Current sync status-`sync_type` | varchar(128) | NULL | Sync strategy-`last_synced_at` | timestamp with tz | NULL | Last successful sync timestamp-`latest_error` | text | NULL | Most recent error message-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`deleted` | boolean | NOT NULL | Soft delete flag-`deleted_at` | timestamp with tz | NULL | Deletion timestamp+{{ schema_columns('system.source_schemas') }}### Status Values@@ -147,17 +112,7 @@ Each job tracks the status, row count, and timing of a single sync operation.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`pipeline_id` | uuid | NOT NULL | FK to `system.data_warehouse_sources.id`-`schema_id` | uuid | NULL | FK to schema being synced-`status` | varchar | NOT NULL | Job status-`rows_synced` | bigint | NULL | Number of rows synced-`billable` | boolean | NULL | Whether this sync job is billable (non-billable syncs don't appear in the syncs UI)-`latest_error` | text | NULL | Error message if failed-`created_at` | timestamp with tz | NOT NULL | Job start timestamp-`finished_at` | timestamp with tz | NULL | Job completion timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp+{{ schema_columns('system.source_sync_jobs') }}### Status Valuesdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-datasets.md b/products/posthog_ai/skills/querying-posthog-data/references/models-datasets.md.j2similarity index 51%rename from products/posthog_ai/skills/querying-posthog-data/references/models-datasets.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-datasets.md.j2index e08ef3b7e2fe..33afefe5103f 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-datasets.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-datasets.md.j2@@ -6,65 +6,25 @@ Every item mutation creates a dataset revision, which makes prior dataset conten## Dataset (`system.datasets`)-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Stable dataset ID-`team_id` | integer | NOT NULL | Owning project-`name` | text | NOT NULL | Dataset name, unique within the project-`description` | text | NOT NULL | Description of what the dataset contains-`metadata` | jsonb | NOT NULL | Dataset-level metadata object-`archived` | boolean | NOT NULL | Whether the dataset is archived-`current_revision_id` | uuid | NULL | Latest committed revision, or NULL before the first item mutation-`created_by_id` | integer | NULL | User who created the dataset-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NULL | Last change to dataset fields or item contents+{{ schema_columns('system.datasets') }}## Dataset revision (`system.dataset_revisions`)-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Dataset revision ID-`team_id` | integer | NOT NULL | Owning project-`dataset_id` | uuid | NOT NULL | Parent dataset ID-`revision` | integer | NOT NULL | Monotonic revision number within the dataset-`created_by_id` | integer | NULL | User who committed the revision-`created_at` | timestamp with tz | NOT NULL | Commit timestamp+{{ schema_columns('system.dataset_revisions') }}Dataset revisions describe item-content snapshots.Editing dataset name, description, or metadata does not create a revision.## Dataset item (`system.dataset_items`)-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Stable item ID shared by every version-`team_id` | integer | NOT NULL | Owning project-`dataset_id` | uuid | NOT NULL | Parent dataset ID-`client_item_id` | varchar(255) | NULL | Optional caller-owned stable key, unique within the dataset-`current_version_id` | uuid | NULL | Latest immutable version ID-`created_by_id` | integer | NULL | User who created the stable item-`created_at` | timestamp with tz | NOT NULL | Item creation timestamp-`updated_at` | timestamp with tz | NULL | Timestamp of the latest item version+{{ schema_columns('system.dataset_items') }}The stable item row does not carry content or archive state.Join `current_version_id` to `system.dataset_item_versions.id` for the current values.## Dataset item version (`system.dataset_item_versions`)-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Immutable item version ID-`team_id` | integer | NOT NULL | Owning project-`dataset_id` | uuid | NOT NULL | Parent dataset ID-`dataset_item_id` | uuid | NOT NULL | Stable item ID-`dataset_revision_id` | uuid | NOT NULL | Revision that introduced this version-`version` | integer | NOT NULL | Monotonic version number within the item-`archived` | boolean | NOT NULL | Whether this version archives the item-`input` | jsonb | NOT NULL | Input supplied to the system under test-`expected_output` | jsonb | NULL | User-authored target output-`source_output` | jsonb | NULL | Actual output copied from a source trace-`metadata` | jsonb | NOT NULL | Item metadata object-`source_trace_id` | varchar(255) | NULL | Source AI trace ID-`source_event_id` | varchar(255) | NULL | Source event ID within the trace-`source_timestamp` | timestamp with tz | NULL | Timestamp used to retrieve the source trace event-`created_by_id` | integer | NULL | User who created this version-`created_at` | timestamp with tz | NOT NULL | Version creation timestamp+{{ schema_columns('system.dataset_item_versions') }}Source output and trace provenance are immutable after item creation.User edits create another version and may change only input, expected output, metadata, and archive state.diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-early-access-features.md b/products/posthog_ai/skills/querying-posthog-data/references/models-early-access-features.md.j2similarity index 76%rename from products/posthog_ai/skills/querying-posthog-data/references/models-early-access-features.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-early-access-features.md.j2index 70165c3732d1..e1d8962b18f8 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-early-access-features.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-early-access-features.md.j2@@ -6,15 +6,7 @@ Early access features let teams manage staged feature rollouts where users can o### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Project/team ID for isolation-`feature_flag_id` | integer | NULL | Linked feature flag ID-`name` | varchar(200) | NOT NULL | Feature name-`description` | text | NOT NULL | Longer description shown in the opt-in UI (may be empty string)-`stage` | varchar(40) | NOT NULL | Lifecycle stage (see values below)-`documentation_url` | varchar(800) | NOT NULL | URL to external docs (may be empty string)-`created_at` | timestamp with tz | NOT NULL | Creation timestamp+{{ schema_columns('system.early_access_features') }}### Stage Valuesdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-endpoints.md b/products/posthog_ai/skills/querying-posthog-data/references/models-endpoints.md.j2similarity index 55%rename from products/posthog_ai/skills/querying-posthog-data/references/models-endpoints.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-endpoints.md.j2index 141e1b326802..2f2c3072f37c 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-endpoints.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-endpoints.md.j2@@ -6,15 +6,7 @@ API endpoints that expose saved HogQL or insight queries as callable API routes.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`name` | varchar(128) | NOT NULL | URL-safe endpoint name (unique per team)-`is_active` | integer | NOT NULL | Whether endpoint is available via the API (0/1)-`current_version` | integer | NOT NULL | Latest version number-`derived_from_insight` | varchar(12) | NULL | Short ID of the source insight-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`last_executed_at` | timestamp with tz | NULL | When endpoint was last executed+{{ schema_columns('system.data_modeling_endpoints') }}### Example Queries@@ -49,16 +41,7 @@ A new version is created each time an endpoint's query changes.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`endpoint_id` | uuid | NOT NULL | FK to endpoints.id-`version` | integer | NOT NULL | Version number (1-based, ascending)-`description` | text | NOT NULL | Version description-`query` | jsonb | NOT NULL | Immutable query snapshot-`data_freshness_seconds` | integer | NOT NULL | How fresh the data should be, in seconds (one of: 900, 1800, 3600, 21600, 43200, 86400, 604800)-`is_active` | integer | NOT NULL | Whether this version can be executed (0/1)-`columns` | jsonb | NULL | Column names and types-`created_at` | timestamp with tz | NOT NULL | When this version was created+{{ schema_columns('system.data_modeling_endpoint_versions') }}### Example Queriesdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md b/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md.j2similarity index 81%rename from products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md.j2index 1382baadb76a..3e36b8b4ac7c 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md.j2@@ -6,14 +6,7 @@ Error tracking issues represent grouped exceptions captured by PostHog SDKs. Eac### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key (UUID)-`team_id` | integer | NOT NULL | PostHog project ID; foreign key to `system.teams.id`-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`status` | varchar | NOT NULL | Issue status (see Status Values below)-`severity` | varchar | NULL | Assigned severity: `low`, `medium`, `high`, or `critical`-`name` | text | NULL | Issue name (typically the exception type/message)-`description` | text | NULL | User-provided description+{{ schema_columns('system.error_tracking_issues') }}### Status Values@@ -49,14 +42,7 @@ Rows can also track missing symbol sets so future uploads know which stack frame### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key (UUID)-`team_id` | integer | NOT NULL | PostHog project ID; foreign key to `system.teams.id`-`ref` | text | NOT NULL | Symbol set reference matched from stack frames-`release_id` | uuid | NULL | Associated error tracking release ID-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`last_used` | timestamp with tz | NULL | Last time this symbol set was used for frame resolution-`failure_reason` | text | NULL | Reason lookup failed when the source map is missing or invalid+{{ schema_columns('system.error_tracking_symbol_sets') }}### Important Notesdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md b/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md.j2similarity index 63%rename from products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md.j2index 4f637cae65b4..25a2d2b31253 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-flags-experiments.md.j2@@ -8,15 +8,7 @@ Feature flags control rollouts of new features and are used for A/B testing.These are the only columns exposed via HogQL — the full flag model (e.g. `active`, `ensure_experience_continuity`, `last_called_at`, rollback settings) is not queryable here; fetch the flag via the feature flag API tools instead.-Column | Type | Nullable | Description-`id` | integer | NOT NULL | Primary key (auto-generated)-`team_id` | integer | NOT NULL | Project scope-`key` | varchar(400) | NOT NULL | Unique flag key per team-`name` | text | NOT NULL | Flag description (not the display name)-`filters` | jsonb | NOT NULL | Targeting conditions and variants-`rollout_percentage` | integer | NULL | Overall rollout percentage-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`deleted` | integer (0/1) | NOT NULL | Soft delete flag+{{ schema_columns('system.feature_flags') }}### Filters Structure@@ -64,19 +56,7 @@ Experiments are A/B tests that compare variants against a control group.These are the only columns exposed via HogQL — the full experiment model (e.g. `deleted`, `conclusion`, `metrics`, `metrics_secondary`, `stats_config`, `exposure_criteria`, `holdout_id`, `type`) is not queryable here; fetch the experiment via the experiment API tools instead.-Column | Type | Nullable | Description-`id` | integer | NOT NULL | Primary key (auto-generated)-`team_id` | integer | NOT NULL | Project scope-`name` | varchar(400) | NOT NULL | Experiment name-`description` | varchar(400) | NULL | Experiment description-`filters` | jsonb | NOT NULL | Legacy target metric definition-`parameters` | jsonb | NULL | Experiment configuration (variants, MDE, sample size)-`start_date` | timestamp with tz | NULL | When experiment started (NULL = draft)-`end_date` | timestamp with tz | NULL | When experiment ended-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`archived` | integer (0/1) | NOT NULL | Whether experiment is archived-`feature_flag_id` | integer | NOT NULL | FK to `system.feature_flags.id`+{{ schema_columns('system.experiments') }}### Parameters Structurediff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-heatmaps.md b/products/posthog_ai/skills/querying-posthog-data/references/models-heatmaps.md.j2similarity index 59%rename from products/posthog_ai/skills/querying-posthog-data/references/models-heatmaps.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-heatmaps.md.j2index 87862da4117a..c1680e5dbf6d 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-heatmaps.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-heatmaps.md.j2@@ -7,19 +7,7 @@ This is a first-class HogQL table (no `system.` prefix). Coordinates are stored### Columns-Column | Type | Nullable | Description-`session_id` | varchar | NOT NULL | Session the interaction belongs to (join to `session_recordings.session_id`)-`team_id` | integer | NOT NULL | Team this interaction belongs to-`distinct_id` | varchar | NOT NULL | Person who interacted-`timestamp` | DateTime64 | NOT NULL | When the interaction happened-`x` | integer | NOT NULL | Horizontal position, stored scaled down by `scale_factor` (multiply to get CSS px)-`y` | integer | NOT NULL | Vertical position, stored scaled down by `scale_factor` (multiply to get CSS px)-`scale_factor` | integer | NOT NULL | Factor the coordinates were divided by at ingestion (always 16); multiply stored values by it to recover CSS pixels-`viewport_width` | integer | NOT NULL | Viewport width, stored scaled down by `scale_factor` (multiply to get CSS px)-`viewport_height` | integer | NOT NULL | Viewport height, stored scaled down by `scale_factor` (multiply to get CSS px)-`pointer_target_fixed` | boolean | NOT NULL | Whether the clicked element is fixed-position-`current_url` | varchar | NOT NULL | Full URL of the page the interaction happened on-`type` | varchar | NOT NULL | `click`, `rageclick`, `mousemove`, or `scrolldepth`+{{ schema_columns('heatmaps') }}### Example: top click hotspots on a page (last 7 days)diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-hog-flows.md b/products/posthog_ai/skills/querying-posthog-data/references/models-hog-flows.md.j2similarity index 59%rename from products/posthog_ai/skills/querying-posthog-data/references/models-hog-flows.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-hog-flows.md.j2index a8524042972d..14e5f95b6e9b 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-hog-flows.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-hog-flows.md.j2@@ -6,19 +6,7 @@ Hog flows are automated user journeys — multi-step workflows that trigger acti### Columns-Column | Type | Nullable | Description-`id` | string (UUID) | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Owning team-`name` | varchar(400) | NULL | Display name-`description` | text | NOT NULL | Description of the flow-`status` | varchar(20) | NOT NULL | `draft`, `active`, or `archived`-`version` | integer | NOT NULL | Version number (incremented on each publish)-`exit_condition` | varchar(100) | NOT NULL | When a user exits the flow (see values below)-`trigger` | jsonb | NOT NULL | Entry trigger configuration-`edges` | jsonb | NOT NULL | Graph edges connecting flow steps-`actions` | jsonb | NOT NULL | Action definitions for each step-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp+{{ schema_columns('system.hog_flows') }}### Status Valuesdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-hog-functions.md b/products/posthog_ai/skills/querying-posthog-data/references/models-hog-functions.md.j2similarity index 64%rename from products/posthog_ai/skills/querying-posthog-data/references/models-hog-functions.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-hog-functions.md.j2index 3ce4ae0bd7e1..a917e899cb51 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-hog-functions.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-hog-functions.md.j2@@ -16,21 +16,7 @@ Hog functions are programmable event handlers in PostHog's CDP (Customer Data Pl### Columns-Column | Type | Nullable | Description-`id` | string (UUID) | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Owning team-`name` | varchar(400) | NULL | Display name-`description` | text | NOT NULL | What the function does-`type` | varchar(24) | NULL | Function type (see values above)-`enabled` | boolean | NOT NULL | Whether the function is active (1 = yes, 0 = no)-`deleted` | boolean | NOT NULL | Soft-delete flag (1 = deleted, 0 = active)-`icon_url` | text | NULL | URL for the function's icon-`template_id` | varchar(400) | NULL | ID of the template this function was created from-`execution_order` | integer | NULL | Execution priority for transformations (lower runs first)-`inputs_schema` | jsonb | NULL | Schema defining configurable input parameters-`filters` | jsonb | NULL | Event filters controlling which events trigger the function-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp+{{ schema_columns('system.hog_functions') }}### Query Examplesdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-messaging-opt-outs.md b/products/posthog_ai/skills/querying-posthog-data/references/models-messaging-opt-outs.md.j2similarity index 50%rename from products/posthog_ai/skills/querying-posthog-data/references/models-messaging-opt-outs.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-messaging-opt-outs.md.j2index 963221ce4133..1a03ff0eb5eb 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-messaging-opt-outs.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-messaging-opt-outs.md.j2@@ -6,14 +6,7 @@ Messaging preferences per recipient, one row per recipient. The `preferences` ma### Columns-Column | Type | Nullable | Description-`id` | string (UUID) | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Owning team-`identifier` | varchar(512) | NOT NULL | Recipient identifier, usually an email address-`preferences` | jsonb | NOT NULL | Map of message category ID to `OPTED_OUT` or `OPTED_IN`. The key `$all` covers all marketing messages; other keys are `message_categories` ids-`deleted` | integer (0/1) | NOT NULL | 1 if soft-deleted; filter with `deleted = 0`-`created_at` | timestamp with tz | NOT NULL | When the recipient was first recorded-`updated_at` | timestamp with tz | NOT NULL | When preferences last changed+{{ schema_columns('system.message_recipient_preferences') }}## Message categories (`system.message_categories`)@@ -21,17 +14,7 @@ Message categories recipients can opt out of, one row per category. Category IDs### Columns-Column | Type | Nullable | Description-`id` | string (UUID) | NOT NULL | Primary key, used as the key in recipient preferences-`team_id` | integer | NOT NULL | Owning team-`key` | varchar(64) | NOT NULL | Stable category key used in the API, e.g. `newsletter`-`name` | varchar(128) | NOT NULL | Display name-`description` | text | NOT NULL | Internal description-`public_description` | text | NOT NULL | Description shown to recipients on the preferences page-`category_type` | varchar | NOT NULL | `marketing` (opt-out applies) or `transactional`-`deleted` | integer (0/1) | NOT NULL | 1 if soft-deleted; filter with `deleted = 0`-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp+{{ schema_columns('system.message_categories') }}### Query Examplesdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-notebooks.md b/products/posthog_ai/skills/querying-posthog-data/references/models-notebooks.md.j2similarity index 65%rename from products/posthog_ai/skills/querying-posthog-data/references/models-notebooks.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-notebooks.md.j2index aa5a2f86485c..d8463944fe59 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-notebooks.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-notebooks.md.j2@@ -6,24 +6,7 @@ Notebooks are collaborative documents combining text, insights, and code.### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key (UUID)-`short_id` | varchar(12) | NOT NULL | Unique short identifier for URLs-`title` | varchar(256) | NULL | Notebook title-`content` | jsonb | NULL | Notebook content blocks-`markdown` | text | NULL | Markdown source when the notebook is stored as a markdown notebook; NULL for legacy rich-text notebooks-`text_content` | text | NULL | Plain text extraction for search-`deleted` | boolean | NOT NULL | Soft delete flag-`visibility` | varchar(20) | NOT NULL | `private`, `shared`, or `public`-`version` | integer | NOT NULL | Content version number-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`last_modified_at` | timestamp with tz | NOT NULL | Last modification timestamp-`created_by_id` | integer | NULL | Creator user ID-`last_modified_by_id` | integer | NULL | Last modifier user ID-`team_id` | integer | NOT NULL | FK to `system.teams.id`-`kernel_cpu_cores` | double precision | NULL | Jupyter kernel CPU allocation-`kernel_memory_gb` | double precision | NULL | Jupyter kernel memory allocation-`kernel_idle_timeout_seconds` | integer | NULL | Kernel idle timeout+{{ schema_columns('system.notebooks') }}### Content Structurediff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-session-recording-playlists.md b/products/posthog_ai/skills/querying-posthog-data/references/models-session-recording-playlists.mddeleted file mode 100644index f3ceb8204c51..000000000000--- a/products/posthog_ai/skills/querying-posthog-data/references/models-session-recording-playlists.md+++ /dev/null@@ -1,38 +0,0 @@-# Session Recording Playlists--## SessionRecordingPlaylist (`system.session_recording_playlists`)--Saved views for organizing session recordings. There are two types: collections (manually curated lists) and filters (saved filter criteria that dynamically match recordings).--### Columns--Column | Type | Nullable | Description-`id` | integer | NOT NULL | Primary key-`short_id` | varchar(12) | NOT NULL | Human-friendly short identifier (used in URLs and API lookups)-`name` | varchar(400) | NULL | Human-readable playlist name-`derived_name` | varchar(400) | NULL | Auto-generated name based on filter criteria-`description` | text | NOT NULL | Playlist description (can be blank)-`team_id` | integer | NOT NULL | Team this playlist belongs to-`pinned` | boolean | NOT NULL | Whether the playlist is pinned to the top-`deleted` | boolean | NOT NULL | Whether the playlist is soft-deleted-`filters` | jsonb | NOT NULL | JSON filter criteria for dynamic matching (only used when type is 'filters')-`type` | varchar(50) | NULL | Playlist type: 'collection' or 'filters'-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`created_by_id` | integer | NULL | FK to the user who created this playlist-`last_modified_at` | timestamp with tz | NOT NULL | When the playlist was last updated-`last_modified_by_id` | integer | NULL | FK to the user who last modified this playlist--### Key Relationships--- Each playlist belongs to a **Team** (`team_id`)-- Playlists are created by a **User** (`created_by_id`)-- Collection playlists contain recordings via `SessionRecordingPlaylistItem` (not exposed as a system table)--### Important Notes--- The `type` field determines behavior:- - `collection` — manually curated list of recordings- - `filters` — saved filter criteria that dynamically match recordings-- Use `short_id` for lookups (this is the API lookup field)-- Use `deleted = false` to filter out soft-deleted playlists-- The `filters` field is only meaningful when `type = 'filters'`diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-session-recording-playlists.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-session-recording-playlists.md.j2new file mode 100644index 000000000000..b3946fbeb85c--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-session-recording-playlists.md.j2@@ -0,0 +1,24 @@+# Session Recording Playlists++## SessionRecordingPlaylist (`system.session_recording_playlists`)++Saved views for organizing session recordings. There are two types: collections (manually curated lists) and filters (saved filter criteria that dynamically match recordings).++### Columns++{{ schema_columns('system.session_recording_playlists') }}++### Key Relationships++- Each playlist belongs to a **Team** (`team_id`)+- Playlists are created by a **User** (`created_by_id`)+- Collection playlists contain recordings via `SessionRecordingPlaylistItem` (not exposed as a system table)++### Important Notes++- The `type` field determines behavior:+ - `collection` — manually curated list of recordings+ - `filters` — saved filter criteria that dynamically match recordings+- Use `short_id` for lookups (this is the API lookup field)+- Use `deleted = 0` to filter out soft-deleted playlists — `deleted` is an integer 0/1+- The `filters` field is only meaningful when `type = 'filters'`diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-session-recordings.md b/products/posthog_ai/skills/querying-posthog-data/references/models-session-recordings.mddeleted file mode 100644index e8fe33f64425..000000000000--- a/products/posthog_ai/skills/querying-posthog-data/references/models-session-recordings.md+++ /dev/null@@ -1,42 +0,0 @@-# Session Recordings--## SessionRecording (`system.session_recordings`)--Metadata for session recordings captured by the PostHog SDK. The actual replay data lives in ClickHouse and object storage; this Postgres table stores recording-level metadata used for listing and filtering.--### Columns--Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Internal UUID primary key-`session_id` | varchar(200) | NOT NULL | SDK-generated session ID (unique)-`team_id` | integer | NOT NULL | Team this recording belongs to-`distinct_id` | varchar(400) | NULL | The distinct ID of the person in this recording-`duration` | integer | NULL | Total recording duration in seconds-`active_seconds` | integer | NULL | Seconds with user activity (clicks, keystrokes, scrolling)-`inactive_seconds` | integer | NULL | Seconds without user activity-`start_time` | timestamp with tz | NULL | When the recording started-`end_time` | timestamp with tz | NULL | When the recording ended-`click_count` | integer | NULL | Number of click events-`keypress_count` | integer | NULL | Number of keypress events-`mouse_activity_count` | integer | NULL | Number of mouse activity events-`console_log_count` | integer | NULL | Number of console.log entries-`console_warn_count` | integer | NULL | Number of console.warn entries-`console_error_count` | integer | NULL | Number of console.error entries-`start_url` | varchar(512) | NULL | URL when the recording started-`deleted` | boolean | NULL | Whether the recording has been deleted-`created_at` | timestamp with tz | NULL | When this metadata record was created-`retention_period_days` | integer | NULL | How long the recording is retained-`storage_version` | varchar(20) | NULL | Storage format version--### Key Relationships--- Each recording belongs to a **Team** (`team_id`)-- Recordings are linked to persons via `distinct_id`-- Recordings can be added to **Session Recording Playlists** via `SessionRecordingPlaylistItem`--### Important Notes--- Recordings are created by the SDK, not via the API-- The `session_id` field is the user-facing ID (used in URLs and API calls), not the internal `id`-- Activity data (click_count, duration, etc.) is populated from ClickHouse and may be NULL for older recordings-- Use `deleted IS NOT TRUE` to filter out soft-deleted recordingsdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-session-recordings.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-session-recordings.md.j2new file mode 100644index 000000000000..c6bc7bae409e--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-session-recordings.md.j2@@ -0,0 +1,22 @@+# Session Recordings++## SessionRecording (`system.session_recordings`)++Metadata for session recordings captured by the PostHog SDK. The actual replay data lives in ClickHouse and object storage; this Postgres table stores recording-level metadata used for listing and filtering.++### Columns++{{ schema_columns('system.session_recordings') }}++### Key Relationships++- Each recording belongs to a **Team** (`team_id`)+- Recordings are linked to persons via `distinct_id`+- Recordings can be added to **Session Recording Playlists** via `SessionRecordingPlaylistItem`++### Important Notes++- Recordings are created by the SDK, not via the API+- The `session_id` field is the user-facing ID (used in URLs and API calls), not the internal `id`+- Activity data (click_count, duration, etc.) is populated from ClickHouse and may be NULL for older recordings+- Filter out soft-deleted recordings with `ifNull(deleted, 0) = 0` — `deleted` is an integer 0/1, NULL for older rowsdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-support-tickets.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-support-tickets.md.j2new file mode 100644index 000000000000..e9ee422f6a66--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-support-tickets.md.j2@@ -0,0 +1,23 @@+# Support Tickets++## Ticket (`system.support_tickets`)++Support tickets from the conversations product, created via widget, email, or Slack channels.++### Columns++{{ schema_columns('system.support_tickets') }}++### Key Relationships++- Tickets belong to a **Team** (`team_id`)+- Tickets can link to a customer analytics account through `organization_id = system.accounts.external_id`+- Tickets are linked to a **Person** via `distinct_id`+- Ticket assignments are managed via `TicketAssignment` and queryable through `system.support_tickets.assignee`++### Important Notes++- The `status` field follows a lifecycle: `new` -> `open` -> `pending`/`on_hold` -> `resolved`+- The `anonymous_traits` field contains customer-provided key-value pairs, commonly including `name` and `email`+- The `session_context` field may contain `session_replay_url`, `current_url`, and other session metadata+- Tickets are never deleted; filter by `status` to exclude resolved ticketsdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-surveys.md b/products/posthog_ai/skills/querying-posthog-data/references/models-surveys.mddeleted file mode 100644index 384aa40715ae..000000000000--- a/products/posthog_ai/skills/querying-posthog-data/references/models-surveys.md+++ /dev/null@@ -1,95 +0,0 @@-# Surveys--## Survey (`system.surveys`)--Surveys collect feedback from users through questions and forms.--### Columns--Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key (UUID)-`name` | varchar(400) | NOT NULL | Survey name (unique per team)-`description` | text | NOT NULL | Survey description-`type` | varchar(40) | NOT NULL | `popover`, `widget`, `external_survey`, `api`-`conditions` | jsonb | NULL | Display conditions-`questions` | jsonb | NULL | Array of survey questions-`appearance` | jsonb | NULL | Styling configuration-`created_at` | timestamp with tz | NOT NULL | Creation timestamp-`start_date` | timestamp with tz | NULL | When survey becomes active-`end_date` | timestamp with tz | NULL | When survey ends-`updated_at` | timestamp with tz | NOT NULL | Last update timestamp-`archived` | boolean | NOT NULL | Whether archived-`created_by_id` | integer | NULL | Creator user ID-`linked_flag_id` | integer | NULL | User-managed FK to feature flag-`targeting_flag_id` | integer | NULL | Auto-managed targeting flag-`internal_targeting_flag_id` | integer | NULL | Internal targeting flag-`internal_response_sampling_flag_id` | integer | NULL | Response sampling flag-`responses_limit` | integer | NULL | Max responses to collect-`linked_insight_id` | integer | NULL | FK to linked insight-`iteration_count` | integer | NULL | Number of iterations-`iteration_frequency_days` | integer | NULL | Days between iterations-`current_iteration` | integer | NULL | Current iteration number-`schedule` | varchar(40) | NULL | `once`, `recurring`, `always`-`enable_partial_responses` | boolean | NULL | Allow partial responses-`enable_iframe_embedding` | boolean | NOT NULL | Allow iframe embedding-`headline_summary` | text | NULL | AI-generated summary-`question_summaries` | jsonb | NULL | Per-question AI summaries-`response_sampling_*` | various | NULL | Response sampling configuration--### Question Types--```json-[- {- "id": "uuid",- "type": "open",- "question": "How can we improve?",- "optional": false,- "buttonText": "Submit"- },- {- "id": "uuid",- "type": "rating",- "question": "How would you rate us?",- "display": "number",- "scale": 10,- "lowerBoundLabel": "Not likely",- "upperBoundLabel": "Very likely"- },- {- "id": "uuid",- "type": "single_choice",- "question": "Which feature do you use most?",- "choices": ["Feature A", "Feature B", "Feature C"]- }-]-```--### Key Relationships--- **Feature Flags**: Multiple flag relationships via `system.feature_flags`-- **Insight**: `linked_insight_id` -> `system.insights.id`-- **Archived responses**: `system.survey_response_archives.survey_id` -> `system.surveys.id`--### Important Notes--- Survey name must be unique per team-- Internal flags (`targeting_flag`, `internal_targeting_flag`, `internal_response_sampling_flag`) are auto-managed-- `linked_flag` is user-managed and optional--## SurveyResponseArchive (`system.survey_response_archives`)--Survey responses are stored as events, so archiving one is recorded in Postgres instead. One row per archived (hidden) response.--### Columns--Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key (UUID)-`survey_id` | uuid | NOT NULL | FK to `system.surveys.id`-`response_uuid` | uuid | NOT NULL | UUID of the event representing the response — join to `events.uuid`-`archived_at` | timestamp with tz | NOT NULL | When the response was archived--### Important Notes--- To exclude archived responses from a survey's results, anti-join the survey events against this table on `events.uuid = survey_response_archives.response_uuid`-- `(team_id, response_uuid)` is uniquediff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-surveys.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/models-surveys.md.j2new file mode 100644index 000000000000..61bf73e4e934--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-surveys.md.j2@@ -0,0 +1,65 @@+# Surveys++## Survey (`system.surveys`)++Surveys collect feedback from users through questions and forms.++### Columns++{{ schema_columns('system.surveys') }}++### Question Types++```json+[+ {+ "id": "uuid",+ "type": "open",+ "question": "How can we improve?",+ "optional": false,+ "buttonText": "Submit"+ },+ {+ "id": "uuid",+ "type": "rating",+ "question": "How would you rate us?",+ "display": "number",+ "scale": 10,+ "lowerBoundLabel": "Not likely",+ "upperBoundLabel": "Very likely"+ },+ {+ "id": "uuid",+ "type": "single_choice",+ "question": "Which feature do you use most?",+ "choices": ["Feature A", "Feature B", "Feature C"]+ }+]+```++### Key Relationships++- **Feature Flags**: Multiple flag relationships via `system.feature_flags`++### Important Notes++- Survey name must be unique per team+- Internal flags (`targeting_flag`, `internal_targeting_flag`, `internal_response_sampling_flag`) are auto-managed+- `linked_flag` is user-managed and optional++## SurveyResponseArchive (`system.survey_response_archives`)++Survey responses are stored as events, so archiving one is recorded in Postgres instead. One row per archived (hidden) response.++### Columns++{{ schema_columns('system.survey_response_archives') }}++### Key Relationships++- **Archived responses**: `system.survey_response_archives.survey_id` -> `system.surveys.id`++### Important Notes++- To exclude archived responses from a survey's results, anti-join the survey events against this table on `events.uuid = survey_response_archives.response_uuid`+- `(team_id, response_uuid)` is uniquediff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-usage-metrics.md b/products/posthog_ai/skills/querying-posthog-data/references/models-usage-metrics.md.j2similarity index 64%rename from products/posthog_ai/skills/querying-posthog-data/references/models-usage-metrics.mdrename to products/posthog_ai/skills/querying-posthog-data/references/models-usage-metrics.md.j2index b9aae45c70db..6871022396ce 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-usage-metrics.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-usage-metrics.md.j2@@ -8,17 +8,7 @@ Usage metrics are team-defined numeric measures that render on Customer Analytic### Columns-Column | Type | Nullable | Description-`id` | uuid | NOT NULL | Primary key-`team_id` | integer | NOT NULL | Team this metric belongs to-`group_type_index` | integer | NOT NULL | **Legacy / effectively unused.** Retained for backward compatibility but the query runner ignores it — every team-owned metric is evaluated against the current entity regardless of this value. Safe to omit from `SELECT` and do not filter on it-`name` | varchar(255) | NOT NULL | Human-readable metric name-`format` | varchar(64) | NOT NULL | `numeric` or `currency` — controls UI formatting-`interval` | integer | NOT NULL | Rolling time window in days used when computing the metric (default 7)-`display` | varchar(64) | NOT NULL | `number` or `sparkline` — controls UI visualization-`filters` | jsonb | NOT NULL | HogQL filter definition: `{"events": [...], "properties": [...]}`. Same shape as HogFunction filters-`math` | varchar(16) | NOT NULL | Aggregation: `count` (count matching events) or `sum` (sum `math_property`)-`math_property` | varchar(255) | NULL | Event property to sum. Required when `math='sum'`, must be null when `math='count'`+{{ schema_columns('system.usage_metrics') }}### Key relationshipsdiff --git a/products/posthog_ai/skills/querying-posthog-data/references/taxonomy-dynamic-properties.md b/products/posthog_ai/skills/querying-posthog-data/references/taxonomy-dynamic-properties.mdindex 43ef0ff66f36..e3f4ecbaeddc 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/taxonomy-dynamic-properties.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/taxonomy-dynamic-properties.md@@ -28,9 +28,8 @@ Use these queries to find the IDs, then construct the property name.### Find survey IDs```sql-SELECT id, name, description, type+SELECT id, name, typeFROM system.surveys-WHERE NOT archivedORDER BY created_at DESCLIMIT 20```@@ -54,7 +53,6 @@ Then query event properties like `$feature/{key}` or person properties like `$fe```sqlSELECT id, name, feature_flag_idFROM system.early_access_features-WHERE NOT deletedORDER BY created_at DESCLIMIT 20```diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.pyindex dc4230e9215e..229395479e96 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.py@@ -1,3 +1,4 @@+import jsonfrom datetime import UTC, datetime, timedeltafrom pathlib import Pathfrom types import SimpleNamespace@@ -182,6 +183,11 @@ def test_resolve_pins_to_last_completed_snapshot_while_parent_is_syncing(tmp_pat# An in-flight full refresh has already committed a partial overwrite on top of v0.deltalake.write_deltalake(uri, pa.table({"id": ["partial"], "last_seen": ["x"], "title": ["y"]}), mode="overwrite")+ partial_refresh_log = Path(uri) / "_delta_log" / "00000000000000000001.json"+ entries = partial_refresh_log.read_text().splitlines()+ partial_refresh_commit = json.loads(entries[0])+ partial_refresh_commit["commitInfo"]["timestamp"] = int(v0_timestamp.timestamp() * 1000) + 1+ partial_refresh_log.write_text("\n".join([json.dumps(partial_refresh_commit), *entries[1:]]) + "\n")pinned = _patched_resolve(uri, snapshot_timestamp=v0_timestamp)