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-ai-observability-evaluations.md

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 | name | String | NOT NULL | Directory name. created_by_id | Integer | NULL | User who created the directory. created_at | DateTime | NOT NULL | When the directory was created. updated_at | DateTime | NULL | When the directory was last updated.

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 | directory_id | UUID | NULL | Directory containing the evaluation; NULL means the top level. name | String | NOT NULL | Evaluation name. description | String | NOT NULL | Evaluation description. enabled | Boolean | NOT NULL | Whether the evaluation is active. status | String | NOT NULL | Evaluation status. status_reason | String | NULL | Reason for the current status, when available. evaluation_type | String | NOT NULL | Evaluation implementation type. evaluation_config | JSON | NOT NULL | Evaluation-specific configuration. output_type | String | NOT NULL | Evaluation result type. output_config | JSON | NOT NULL | Evaluation output configuration. conditions | JSON | NOT NULL | Conditions that select matching input. target | String | NOT NULL | Unit evaluated, such as a generation or trace. target_config | JSON | 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 | DateTime | NOT NULL | When the evaluation was created. updated_at | DateTime | NOT NULL | When the evaluation was last updated. 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:

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:

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