[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-posthog-signals":3,"mdc--4jbt1b-key":38,"related-repo-posthog-signals":2750,"related-org-posthog-signals":2870},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":33,"sourceUrl":36,"mdContent":37},"signals","query semantic signals in PostHog","How to query the document_embeddings table for raw signal data using HogQL. Use when you need to perform semantic search over signals, fetch every signal that contributed to a specific report, or list signal types. For browsing the curated report layer (the Inbox) — listing reports, filtering by status\u002Fsource, drilling into a single report by ID — use the `inbox-exploration` skill first; drop into this skill afterwards if the user wants the underlying observations.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"posthog","PostHog","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fposthog.png",[12,14,17,20],{"name":9,"slug":8,"type":13},"tag",{"name":15,"slug":16,"type":13},"Search","search",{"name":18,"slug":19,"type":13},"Analytics","analytics",{"name":21,"slug":22,"type":13},"SQL","sql",59,"https:\u002F\u002Fgithub.com\u002FPostHog\u002Fai-plugin","2026-04-06T18:44:28.124881",null,11,[29,30,31,32],"claude-code-plugin","codex-plugin","cursor-plugin","gemini-cli-extension",{"repoUrl":24,"stars":23,"forks":27,"topics":34,"description":35},[29,30,31,32],"Official PostHog plugin for Claude Code, Cursor, Gemini, Codex and other AI coding tools","https:\u002F\u002Fgithub.com\u002FPostHog\u002Fai-plugin\u002Ftree\u002FHEAD\u002Fskills\u002Fsignals","---\nname: signals\ndescription: >\n  How to query the document_embeddings table for raw signal data using HogQL. Use when you need to\n  perform semantic search over signals, fetch every signal that contributed to a specific report,\n  or list signal types. For browsing the curated report layer (the Inbox) — listing reports,\n  filtering by status\u002Fsource, drilling into a single report by ID — use the `inbox-exploration`\n  skill first; drop into this skill afterwards if the user wants the underlying observations.\n---\n\n# Querying Signals\n\n## What Are Signals?\n\nSignals are automated observations that PostHog generates by monitoring a customer's product data across multiple sources — error tracking, web analytics, experiments, session replay, and more. Each signal is a short natural-language description of something noteworthy (e.g. \"Error rate spiked 3× on \u002Fcheckout\").\n\nSignals are grouped into **Signal Reports**. When a report accumulates enough weight it gets summarized and assessed for actionability. A signal report represents a cluster of related observations that together describe a meaningful issue or trend.\n\nSignals and their embeddings are stored in the `document_embeddings` ClickHouse table, queryable via HogQL through the `posthog:execute-sql` MCP tool. They may provide a useful way to semantically query for recent things that happened in the user's product.\n\n## When to use this skill vs. `inbox-exploration`\n\nThe two skills cover different layers of the same product:\n\n- **`inbox-exploration`** — curated report layer via dedicated MCP tools (`inbox-reports-list`, `inbox-reports-retrieve`, `inbox-source-configs-list`, `inbox-source-configs-retrieve`). Use for \"what's in my inbox?\", \"what's actionable?\", filtering reports by status \u002F source \u002F suggested reviewer, looking up a specific report by ID or URL.\n- **This skill (`signals`)** — raw signal layer via HogQL on `document_embeddings`. Use when the curated report layer is not enough: semantic search over signal text, fetching every signal that contributed to a specific report, listing what kinds of signals exist, or any ad-hoc analytics that the report tools don't expose.\n\nThe typical pattern is to start with `inbox-exploration`, get a `report_id` or a sense of the area the user cares about, then drop into this skill when the user wants to see the raw observations.\n\n## Table and Column Reference\n\nThe HogQL table alias is `document_embeddings`. HogQL automatically constrains queries to the current team — you never need to filter on `team_id`. Key columns for signals:\n\n| Column          | Type           | Description                                                                  |\n| --------------- | -------------- | ---------------------------------------------------------------------------- |\n| `product`       | String         | Product bucket — always `'signals'` for signals                              |\n| `document_type` | String         | Document type — always `'signal'` for signals                                |\n| `model_name`    | String         | Embedding model — always `'text-embedding-3-small-1536'`                     |\n| `document_id`   | String         | Unique signal ID (UUID)                                                      |\n| `timestamp`     | DateTime64(3)  | When the signal was created                                                  |\n| `inserted_at`   | DateTime64(3)  | When this row version was inserted (used for deduplication and soft deletes) |\n| `content`       | String         | The signal description text                                                  |\n| `metadata`      | String         | JSON string with report_id, source info, weight, deleted flag, etc           |\n| `embedding`     | Array(Float64) | 1536-dimensional embedding vector                                            |\n\n## Mandatory Filters\n\nEvery signals query MUST include all four of these filters. Missing any of them can cause the query to fail with an invalid model error, return wrong data, or trigger unnecessarily expensive scans:\n\n```sql\nWHERE model_name = 'text-embedding-3-small-1536'\n  AND product = 'signals'\n  AND document_type = 'signal'\n  AND timestamp >= now() - INTERVAL 30 DAY\n```\n\nThe `model_name` filter is especially critical — the HogQL engine uses it to route to the correct underlying ClickHouse table. If the `WHERE model_name = ...` equality filter is missing or uses an unknown model, the query will fail with an \"Invalid model name\" error (you cannot use `IN` or other expressions here).\n\nThe `product` and `document_type` filters are equally important — the same model contains data from multiple products (e.g. error tracking, AI memory). Without these filters you will get unrelated data mixed in.\n\nThe `timestamp` filter is required for performance — the table is partitioned by week and has a 3-month TTL. Always include a time bound using `now() - INTERVAL N DAY` (or `WEEK`, `MONTH`, etc.). Default to 30 days unless you have a reason to look further back. Generally, more recent data is more likely to be relevant, unless investigating a long-standing issue.\n\n## Deduplication Pattern\n\nThe underlying table can contain multiple versions of the same signal (e.g. after a soft-delete re-emission). You MUST always deduplicate by wrapping reads in a subquery using `argMax(..., inserted_at)` grouped by `document_id`.\n\n**Note:** HogQL supports `metadata.field_name` dot access on the raw `metadata` JSON column, but this type information is lost when the column passes through aggregate functions like `argMax()`. You MUST extract individual metadata fields inside the inner dedup subquery — do NOT pass the whole `metadata` blob through `argMax` and dot into it in the outer query, as this will fail with a type error.\n\nHogQL's JSON dot access always extracts values as `Nullable(String)`, regardless of the underlying JSON type. This means `metadata.deleted` is the string `'true'`\u002F`'false'`\u002F`null`, not a Bool. Use `deleted != 'true'` — do NOT use `NOT deleted`.\n\n```sql\nSELECT ... FROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(embedding, inserted_at) as embedding,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\n```\n\nOnly select the `embedding` column in the inner subquery when you actually need it for similarity searches — it's a 1536-element float array and expensive to materialize otherwise.\n\n## The `embedText()` Function\n\n`embedText()` is a HogQL function that converts a text string into an embedding vector at query compile time. It calls the embedding API and inlines the resulting vector as a constant before executing the query. This means you can do semantic search in a single query without any external embedding step.\n\n**Signature:** `embedText(text, model_name)`\n\n- `text` — the string to embed. **Must be a string literal**, not a column reference.\n- `model_name` — the embedding model to use. **For signals, always use `'text-embedding-3-small-1536'`.**\n\nBoth arguments must be literal strings. You cannot pass column values or expressions — the function resolves at compile time, not per row.\n\n## `cosineDistance()` for Similarity Search\n\nUse `cosineDistance(embedding, ...)` to rank signals by semantic similarity. Lower values = more similar. Always `ORDER BY distance ASC` and add a `LIMIT`.\n\n```sql\ncosineDistance(embedding, embedText('your search text', 'text-embedding-3-small-1536')) as distance\n```\n\nThe embedding model (`text-embedding-3-small-1536`) uses matryoshka representation learning, so the embedding dimensions are ordered by importance. This means similarity search works well even at high dimensionality — the curse of dimensionality is not a significant concern here.\n\n## Metadata JSON Fields\n\nThe `metadata` column is a JSON string. HogQL supports `metadata.field_name` dot access **only on the raw table column**. After aggregation (e.g. `argMax`), the JSON type is lost and dot access will fail. Always extract the fields you need inside the dedup subquery.\n\n| Field            | Inner-query access        | Description                                                         |\n| ---------------- | ------------------------- | ------------------------------------------------------------------- |\n| `report_id`      | `metadata.report_id`      | UUID of the parent Signal Report (empty if unassigned)              |\n| `source_product` | `metadata.source_product` | Originating product (use Example 3 to discover available values)    |\n| `source_type`    | `metadata.source_type`    | Signal type (use Example 3 to discover available values)            |\n| `source_id`      | `metadata.source_id`      | ID of the source entity                                             |\n| `weight`         | `metadata.weight`         | Signal weight (contributes to report promotion threshold)           |\n| `deleted`        | `metadata.deleted`        | Soft-deletion flag (extracted as String — compare with `!= 'true'`) |\n| `extra`          | `metadata.extra`          | Arbitrary JSON blob from the source product                         |\n| `match_metadata` | `metadata.match_metadata` | LLM match reasoning stored during grouping                          |\n\n---\n\n## Example 1: Semantic Search for Signals\n\nFind signals most similar to a natural-language query. This is the most useful query for understanding what's happening in a customer's product:\n\n```sql\nSELECT\n    document_id,\n    content,\n    report_id,\n    source_product,\n    source_type,\n    cosineDistance(embedding, embedText('users seeing errors on checkout page', 'text-embedding-3-small-1536')) as distance\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(embedding, inserted_at) as embedding,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\nORDER BY distance ASC\nLIMIT 10\n```\n\nAdjust the `embedText` first argument to whatever you're looking for. Write it as a natural-language description of the kind of issue or observation you want to find.\n\nTo restrict to signals that have already been grouped into a report, add `AND report_id != ''` to the outer WHERE.\n\n## Example 2: Fetch All Signals for a Specific Report\n\nOnce you have a `report_id` (from a semantic search or from the Signal Reports API), fetch all signals belonging to that report:\n\n```sql\nSELECT\n    document_id,\n    content,\n    report_id,\n    source_product,\n    source_type,\n    signal_ts\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 3 MONTH\n    GROUP BY document_id\n)\nWHERE report_id = '\u003Creport-uuid-here>'\n  AND deleted != 'true'\nORDER BY signal_ts ASC\nLIMIT 100\n```\n\n## Example 3: List Signal Types\n\nSee what kinds of signals exist for this customer — returns one example per unique `(source_product, source_type)` pair from the last month:\n\n```sql\nSELECT\n    source_product,\n    source_type,\n    count() as cnt,\n    max(signal_ts) as latest_timestamp\nFROM (\n    SELECT\n        document_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\nGROUP BY source_product, source_type\nORDER BY latest_timestamp DESC\nLIMIT 100\n```\n\n## Example 4: Recent Signals from a Specific Source\n\nFind the latest signals from a particular product source (e.g. all error tracking signals):\n\n```sql\nSELECT\n    document_id,\n    content,\n    source_type,\n    report_id,\n    signal_ts\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 WEEK\n    GROUP BY document_id\n)\nWHERE source_product = 'error_tracking'\n  AND deleted != 'true'\nORDER BY signal_ts DESC\nLIMIT 100\n```\n\nReplace `'error_tracking'` with any source product: `'web_analytics'`, `'experiments'`, `'session_replay'`, etc. Use Example 3 to discover what source products and types exist.\n\n## Example 5: Full-Text Search for Signals\n\nWhen you know a specific keyword or phrase to search for (e.g. a product name, error message, or URL), full-text search with `ILIKE` is faster and more precise than semantic search:\n\n```sql\nSELECT\n    document_id,\n    content,\n    source_product,\n    source_type,\n    signal_ts\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\n  AND content ILIKE '%feature flag%'\nORDER BY signal_ts DESC\nLIMIT 10\n```\n\nReplace `'%feature flag%'` with whatever term you're looking for. Use `ILIKE` for case-insensitive substring matching. For exact token matching, use `hasTokenCaseInsensitive(content, 'token')` instead.\n\n## Gotchas\n\n1. **Always use `text-embedding-3-small-1536` as the model name.** This is the only model used for signals.\n2. **`embedText()` arguments must be string literals.** You cannot pass column references or expressions — the function resolves at compile time, not per row.\n3. **Always time-bound your queries.** The table has a 3-month TTL, but unbounded scans are expensive. Use `timestamp >= now() - INTERVAL 1 MONTH` or tighter. Place the time filter in the inner subquery's `WHERE` clause (on the raw `timestamp` column) for best performance.\n4. **Always deduplicate.** Without the `argMax(..., inserted_at) GROUP BY document_id` subquery, you will see stale and duplicate rows.\n5. **Only select `embedding` when you need it.** It's a 1536-element float array — omit it from the inner subquery when you're not doing similarity search.\n6. **Queries should not end with a semicolon.** HogQL does not use them.\n7. **Add a `LIMIT` to every query.** Maximum allowed is 500 rows. In general, you should only select 10 or so signals, using semantic or full text search to rank them.\n8. **Extract metadata fields inside the dedup subquery.** HogQL's `metadata.field` dot access only works on the raw table column. After `argMax()` aggregation, the JSON type is lost and dot access will fail with a type error. Always use `argMax(metadata.field_name, inserted_at) as field_name` in the inner query.\n9. **All JSON dot-access values are `Nullable(String)`.** HogQL extracts every JSON field as a String, even booleans and numbers. For `metadata.deleted`, use `deleted != 'true'` — do NOT use `NOT deleted`.\n10. **Don't alias `argMax(timestamp, inserted_at)` as `timestamp` if the same inner query also filters on the raw `timestamp` column.** HogQL resolves the alias name first, causing an \"aggregate in WHERE\" error. Either use a distinct alias like `signal_ts`, or move the time filter to the outer query.\n",{"data":39,"body":40},{"name":4,"description":6},{"type":41,"children":42},"root",[43,52,59,65,78,100,112,117,189,209,215,235,481,487,492,540,568,586,620,626,646,694,753,917,929,942,952,968,1009,1014,1026,1054,1068,1081,1087,1119,1358,1362,1368,1373,1588,1601,1614,1620,1632,1834,1840,1853,2032,2038,2043,2235,2270,2276,2289,2472,2499,2505,2744],{"type":44,"tag":45,"props":46,"children":48},"element","h1",{"id":47},"querying-signals",[49],{"type":50,"value":51},"text","Querying Signals",{"type":44,"tag":53,"props":54,"children":56},"h2",{"id":55},"what-are-signals",[57],{"type":50,"value":58},"What Are Signals?",{"type":44,"tag":60,"props":61,"children":62},"p",{},[63],{"type":50,"value":64},"Signals are automated observations that PostHog generates by monitoring a customer's product data across multiple sources — error tracking, web analytics, experiments, session replay, and more. Each signal is a short natural-language description of something noteworthy (e.g. \"Error rate spiked 3× on \u002Fcheckout\").",{"type":44,"tag":60,"props":66,"children":67},{},[68,70,76],{"type":50,"value":69},"Signals are grouped into ",{"type":44,"tag":71,"props":72,"children":73},"strong",{},[74],{"type":50,"value":75},"Signal Reports",{"type":50,"value":77},". When a report accumulates enough weight it gets summarized and assessed for actionability. A signal report represents a cluster of related observations that together describe a meaningful issue or trend.",{"type":44,"tag":60,"props":79,"children":80},{},[81,83,90,92,98],{"type":50,"value":82},"Signals and their embeddings are stored in the ",{"type":44,"tag":84,"props":85,"children":87},"code",{"className":86},[],[88],{"type":50,"value":89},"document_embeddings",{"type":50,"value":91}," ClickHouse table, queryable via HogQL through the ",{"type":44,"tag":84,"props":93,"children":95},{"className":94},[],[96],{"type":50,"value":97},"posthog:execute-sql",{"type":50,"value":99}," MCP tool. They may provide a useful way to semantically query for recent things that happened in the user's product.",{"type":44,"tag":53,"props":101,"children":103},{"id":102},"when-to-use-this-skill-vs-inbox-exploration",[104,106],{"type":50,"value":105},"When to use this skill vs. ",{"type":44,"tag":84,"props":107,"children":109},{"className":108},[],[110],{"type":50,"value":111},"inbox-exploration",{"type":44,"tag":60,"props":113,"children":114},{},[115],{"type":50,"value":116},"The two skills cover different layers of the same product:",{"type":44,"tag":118,"props":119,"children":120},"ul",{},[121,165],{"type":44,"tag":122,"props":123,"children":124},"li",{},[125,133,135,141,143,149,150,156,157,163],{"type":44,"tag":71,"props":126,"children":127},{},[128],{"type":44,"tag":84,"props":129,"children":131},{"className":130},[],[132],{"type":50,"value":111},{"type":50,"value":134}," — curated report layer via dedicated MCP tools (",{"type":44,"tag":84,"props":136,"children":138},{"className":137},[],[139],{"type":50,"value":140},"inbox-reports-list",{"type":50,"value":142},", ",{"type":44,"tag":84,"props":144,"children":146},{"className":145},[],[147],{"type":50,"value":148},"inbox-reports-retrieve",{"type":50,"value":142},{"type":44,"tag":84,"props":151,"children":153},{"className":152},[],[154],{"type":50,"value":155},"inbox-source-configs-list",{"type":50,"value":142},{"type":44,"tag":84,"props":158,"children":160},{"className":159},[],[161],{"type":50,"value":162},"inbox-source-configs-retrieve",{"type":50,"value":164},"). Use for \"what's in my inbox?\", \"what's actionable?\", filtering reports by status \u002F source \u002F suggested reviewer, looking up a specific report by ID or URL.",{"type":44,"tag":122,"props":166,"children":167},{},[168,180,182,187],{"type":44,"tag":71,"props":169,"children":170},{},[171,173,178],{"type":50,"value":172},"This skill (",{"type":44,"tag":84,"props":174,"children":176},{"className":175},[],[177],{"type":50,"value":4},{"type":50,"value":179},")",{"type":50,"value":181}," — raw signal layer via HogQL on ",{"type":44,"tag":84,"props":183,"children":185},{"className":184},[],[186],{"type":50,"value":89},{"type":50,"value":188},". Use when the curated report layer is not enough: semantic search over signal text, fetching every signal that contributed to a specific report, listing what kinds of signals exist, or any ad-hoc analytics that the report tools don't expose.",{"type":44,"tag":60,"props":190,"children":191},{},[192,194,199,201,207],{"type":50,"value":193},"The typical pattern is to start with ",{"type":44,"tag":84,"props":195,"children":197},{"className":196},[],[198],{"type":50,"value":111},{"type":50,"value":200},", get a ",{"type":44,"tag":84,"props":202,"children":204},{"className":203},[],[205],{"type":50,"value":206},"report_id",{"type":50,"value":208}," or a sense of the area the user cares about, then drop into this skill when the user wants to see the raw observations.",{"type":44,"tag":53,"props":210,"children":212},{"id":211},"table-and-column-reference",[213],{"type":50,"value":214},"Table and Column Reference",{"type":44,"tag":60,"props":216,"children":217},{},[218,220,225,227,233],{"type":50,"value":219},"The HogQL table alias is ",{"type":44,"tag":84,"props":221,"children":223},{"className":222},[],[224],{"type":50,"value":89},{"type":50,"value":226},". HogQL automatically constrains queries to the current team — you never need to filter on ",{"type":44,"tag":84,"props":228,"children":230},{"className":229},[],[231],{"type":50,"value":232},"team_id",{"type":50,"value":234},". Key columns for signals:",{"type":44,"tag":236,"props":237,"children":238},"table",{},[239,263],{"type":44,"tag":240,"props":241,"children":242},"thead",{},[243],{"type":44,"tag":244,"props":245,"children":246},"tr",{},[247,253,258],{"type":44,"tag":248,"props":249,"children":250},"th",{},[251],{"type":50,"value":252},"Column",{"type":44,"tag":248,"props":254,"children":255},{},[256],{"type":50,"value":257},"Type",{"type":44,"tag":248,"props":259,"children":260},{},[261],{"type":50,"value":262},"Description",{"type":44,"tag":264,"props":265,"children":266},"tbody",{},[267,298,326,353,374,396,417,438,459],{"type":44,"tag":244,"props":268,"children":269},{},[270,280,285],{"type":44,"tag":271,"props":272,"children":273},"td",{},[274],{"type":44,"tag":84,"props":275,"children":277},{"className":276},[],[278],{"type":50,"value":279},"product",{"type":44,"tag":271,"props":281,"children":282},{},[283],{"type":50,"value":284},"String",{"type":44,"tag":271,"props":286,"children":287},{},[288,290,296],{"type":50,"value":289},"Product bucket — always ",{"type":44,"tag":84,"props":291,"children":293},{"className":292},[],[294],{"type":50,"value":295},"'signals'",{"type":50,"value":297}," for signals",{"type":44,"tag":244,"props":299,"children":300},{},[301,310,314],{"type":44,"tag":271,"props":302,"children":303},{},[304],{"type":44,"tag":84,"props":305,"children":307},{"className":306},[],[308],{"type":50,"value":309},"document_type",{"type":44,"tag":271,"props":311,"children":312},{},[313],{"type":50,"value":284},{"type":44,"tag":271,"props":315,"children":316},{},[317,319,325],{"type":50,"value":318},"Document type — always ",{"type":44,"tag":84,"props":320,"children":322},{"className":321},[],[323],{"type":50,"value":324},"'signal'",{"type":50,"value":297},{"type":44,"tag":244,"props":327,"children":328},{},[329,338,342],{"type":44,"tag":271,"props":330,"children":331},{},[332],{"type":44,"tag":84,"props":333,"children":335},{"className":334},[],[336],{"type":50,"value":337},"model_name",{"type":44,"tag":271,"props":339,"children":340},{},[341],{"type":50,"value":284},{"type":44,"tag":271,"props":343,"children":344},{},[345,347],{"type":50,"value":346},"Embedding model — always ",{"type":44,"tag":84,"props":348,"children":350},{"className":349},[],[351],{"type":50,"value":352},"'text-embedding-3-small-1536'",{"type":44,"tag":244,"props":354,"children":355},{},[356,365,369],{"type":44,"tag":271,"props":357,"children":358},{},[359],{"type":44,"tag":84,"props":360,"children":362},{"className":361},[],[363],{"type":50,"value":364},"document_id",{"type":44,"tag":271,"props":366,"children":367},{},[368],{"type":50,"value":284},{"type":44,"tag":271,"props":370,"children":371},{},[372],{"type":50,"value":373},"Unique signal ID (UUID)",{"type":44,"tag":244,"props":375,"children":376},{},[377,386,391],{"type":44,"tag":271,"props":378,"children":379},{},[380],{"type":44,"tag":84,"props":381,"children":383},{"className":382},[],[384],{"type":50,"value":385},"timestamp",{"type":44,"tag":271,"props":387,"children":388},{},[389],{"type":50,"value":390},"DateTime64(3)",{"type":44,"tag":271,"props":392,"children":393},{},[394],{"type":50,"value":395},"When the signal was created",{"type":44,"tag":244,"props":397,"children":398},{},[399,408,412],{"type":44,"tag":271,"props":400,"children":401},{},[402],{"type":44,"tag":84,"props":403,"children":405},{"className":404},[],[406],{"type":50,"value":407},"inserted_at",{"type":44,"tag":271,"props":409,"children":410},{},[411],{"type":50,"value":390},{"type":44,"tag":271,"props":413,"children":414},{},[415],{"type":50,"value":416},"When this row version was inserted (used for deduplication and soft deletes)",{"type":44,"tag":244,"props":418,"children":419},{},[420,429,433],{"type":44,"tag":271,"props":421,"children":422},{},[423],{"type":44,"tag":84,"props":424,"children":426},{"className":425},[],[427],{"type":50,"value":428},"content",{"type":44,"tag":271,"props":430,"children":431},{},[432],{"type":50,"value":284},{"type":44,"tag":271,"props":434,"children":435},{},[436],{"type":50,"value":437},"The signal description text",{"type":44,"tag":244,"props":439,"children":440},{},[441,450,454],{"type":44,"tag":271,"props":442,"children":443},{},[444],{"type":44,"tag":84,"props":445,"children":447},{"className":446},[],[448],{"type":50,"value":449},"metadata",{"type":44,"tag":271,"props":451,"children":452},{},[453],{"type":50,"value":284},{"type":44,"tag":271,"props":455,"children":456},{},[457],{"type":50,"value":458},"JSON string with report_id, source info, weight, deleted flag, etc",{"type":44,"tag":244,"props":460,"children":461},{},[462,471,476],{"type":44,"tag":271,"props":463,"children":464},{},[465],{"type":44,"tag":84,"props":466,"children":468},{"className":467},[],[469],{"type":50,"value":470},"embedding",{"type":44,"tag":271,"props":472,"children":473},{},[474],{"type":50,"value":475},"Array(Float64)",{"type":44,"tag":271,"props":477,"children":478},{},[479],{"type":50,"value":480},"1536-dimensional embedding vector",{"type":44,"tag":53,"props":482,"children":484},{"id":483},"mandatory-filters",[485],{"type":50,"value":486},"Mandatory Filters",{"type":44,"tag":60,"props":488,"children":489},{},[490],{"type":50,"value":491},"Every signals query MUST include all four of these filters. Missing any of them can cause the query to fail with an invalid model error, return wrong data, or trigger unnecessarily expensive scans:",{"type":44,"tag":493,"props":494,"children":498},"pre",{"className":495,"code":496,"language":22,"meta":497,"style":497},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","WHERE model_name = 'text-embedding-3-small-1536'\n  AND product = 'signals'\n  AND document_type = 'signal'\n  AND timestamp >= now() - INTERVAL 30 DAY\n","",[499],{"type":44,"tag":84,"props":500,"children":501},{"__ignoreMap":497},[502,513,522,531],{"type":44,"tag":503,"props":504,"children":507},"span",{"class":505,"line":506},"line",1,[508],{"type":44,"tag":503,"props":509,"children":510},{},[511],{"type":50,"value":512},"WHERE model_name = 'text-embedding-3-small-1536'\n",{"type":44,"tag":503,"props":514,"children":516},{"class":505,"line":515},2,[517],{"type":44,"tag":503,"props":518,"children":519},{},[520],{"type":50,"value":521},"  AND product = 'signals'\n",{"type":44,"tag":503,"props":523,"children":525},{"class":505,"line":524},3,[526],{"type":44,"tag":503,"props":527,"children":528},{},[529],{"type":50,"value":530},"  AND document_type = 'signal'\n",{"type":44,"tag":503,"props":532,"children":534},{"class":505,"line":533},4,[535],{"type":44,"tag":503,"props":536,"children":537},{},[538],{"type":50,"value":539},"  AND timestamp >= now() - INTERVAL 30 DAY\n",{"type":44,"tag":60,"props":541,"children":542},{},[543,545,550,552,558,560,566],{"type":50,"value":544},"The ",{"type":44,"tag":84,"props":546,"children":548},{"className":547},[],[549],{"type":50,"value":337},{"type":50,"value":551}," filter is especially critical — the HogQL engine uses it to route to the correct underlying ClickHouse table. If the ",{"type":44,"tag":84,"props":553,"children":555},{"className":554},[],[556],{"type":50,"value":557},"WHERE model_name = ...",{"type":50,"value":559}," equality filter is missing or uses an unknown model, the query will fail with an \"Invalid model name\" error (you cannot use ",{"type":44,"tag":84,"props":561,"children":563},{"className":562},[],[564],{"type":50,"value":565},"IN",{"type":50,"value":567}," or other expressions here).",{"type":44,"tag":60,"props":569,"children":570},{},[571,572,577,579,584],{"type":50,"value":544},{"type":44,"tag":84,"props":573,"children":575},{"className":574},[],[576],{"type":50,"value":279},{"type":50,"value":578}," and ",{"type":44,"tag":84,"props":580,"children":582},{"className":581},[],[583],{"type":50,"value":309},{"type":50,"value":585}," filters are equally important — the same model contains data from multiple products (e.g. error tracking, AI memory). Without these filters you will get unrelated data mixed in.",{"type":44,"tag":60,"props":587,"children":588},{},[589,590,595,597,603,605,611,612,618],{"type":50,"value":544},{"type":44,"tag":84,"props":591,"children":593},{"className":592},[],[594],{"type":50,"value":385},{"type":50,"value":596}," filter is required for performance — the table is partitioned by week and has a 3-month TTL. Always include a time bound using ",{"type":44,"tag":84,"props":598,"children":600},{"className":599},[],[601],{"type":50,"value":602},"now() - INTERVAL N DAY",{"type":50,"value":604}," (or ",{"type":44,"tag":84,"props":606,"children":608},{"className":607},[],[609],{"type":50,"value":610},"WEEK",{"type":50,"value":142},{"type":44,"tag":84,"props":613,"children":615},{"className":614},[],[616],{"type":50,"value":617},"MONTH",{"type":50,"value":619},", etc.). Default to 30 days unless you have a reason to look further back. Generally, more recent data is more likely to be relevant, unless investigating a long-standing issue.",{"type":44,"tag":53,"props":621,"children":623},{"id":622},"deduplication-pattern",[624],{"type":50,"value":625},"Deduplication Pattern",{"type":44,"tag":60,"props":627,"children":628},{},[629,631,637,639,644],{"type":50,"value":630},"The underlying table can contain multiple versions of the same signal (e.g. after a soft-delete re-emission). You MUST always deduplicate by wrapping reads in a subquery using ",{"type":44,"tag":84,"props":632,"children":634},{"className":633},[],[635],{"type":50,"value":636},"argMax(..., inserted_at)",{"type":50,"value":638}," grouped by ",{"type":44,"tag":84,"props":640,"children":642},{"className":641},[],[643],{"type":50,"value":364},{"type":50,"value":645},".",{"type":44,"tag":60,"props":647,"children":648},{},[649,654,656,662,664,669,671,677,679,684,686,692],{"type":44,"tag":71,"props":650,"children":651},{},[652],{"type":50,"value":653},"Note:",{"type":50,"value":655}," HogQL supports ",{"type":44,"tag":84,"props":657,"children":659},{"className":658},[],[660],{"type":50,"value":661},"metadata.field_name",{"type":50,"value":663}," dot access on the raw ",{"type":44,"tag":84,"props":665,"children":667},{"className":666},[],[668],{"type":50,"value":449},{"type":50,"value":670}," JSON column, but this type information is lost when the column passes through aggregate functions like ",{"type":44,"tag":84,"props":672,"children":674},{"className":673},[],[675],{"type":50,"value":676},"argMax()",{"type":50,"value":678},". You MUST extract individual metadata fields inside the inner dedup subquery — do NOT pass the whole ",{"type":44,"tag":84,"props":680,"children":682},{"className":681},[],[683],{"type":50,"value":449},{"type":50,"value":685}," blob through ",{"type":44,"tag":84,"props":687,"children":689},{"className":688},[],[690],{"type":50,"value":691},"argMax",{"type":50,"value":693}," and dot into it in the outer query, as this will fail with a type error.",{"type":44,"tag":60,"props":695,"children":696},{},[697,699,705,707,713,715,721,723,729,730,736,738,744,746,752],{"type":50,"value":698},"HogQL's JSON dot access always extracts values as ",{"type":44,"tag":84,"props":700,"children":702},{"className":701},[],[703],{"type":50,"value":704},"Nullable(String)",{"type":50,"value":706},", regardless of the underlying JSON type. This means ",{"type":44,"tag":84,"props":708,"children":710},{"className":709},[],[711],{"type":50,"value":712},"metadata.deleted",{"type":50,"value":714}," is the string ",{"type":44,"tag":84,"props":716,"children":718},{"className":717},[],[719],{"type":50,"value":720},"'true'",{"type":50,"value":722},"\u002F",{"type":44,"tag":84,"props":724,"children":726},{"className":725},[],[727],{"type":50,"value":728},"'false'",{"type":50,"value":722},{"type":44,"tag":84,"props":731,"children":733},{"className":732},[],[734],{"type":50,"value":735},"null",{"type":50,"value":737},", not a Bool. Use ",{"type":44,"tag":84,"props":739,"children":741},{"className":740},[],[742],{"type":50,"value":743},"deleted != 'true'",{"type":50,"value":745}," — do NOT use ",{"type":44,"tag":84,"props":747,"children":749},{"className":748},[],[750],{"type":50,"value":751},"NOT deleted",{"type":50,"value":645},{"type":44,"tag":493,"props":754,"children":756},{"className":495,"code":755,"language":22,"meta":497,"style":497},"SELECT ... FROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(embedding, inserted_at) as embedding,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\n",[757],{"type":44,"tag":84,"props":758,"children":759},{"__ignoreMap":497},[760,768,776,784,792,801,810,819,828,837,846,854,863,872,881,890,899,908],{"type":44,"tag":503,"props":761,"children":762},{"class":505,"line":506},[763],{"type":44,"tag":503,"props":764,"children":765},{},[766],{"type":50,"value":767},"SELECT ... FROM (\n",{"type":44,"tag":503,"props":769,"children":770},{"class":505,"line":515},[771],{"type":44,"tag":503,"props":772,"children":773},{},[774],{"type":50,"value":775},"    SELECT\n",{"type":44,"tag":503,"props":777,"children":778},{"class":505,"line":524},[779],{"type":44,"tag":503,"props":780,"children":781},{},[782],{"type":50,"value":783},"        document_id,\n",{"type":44,"tag":503,"props":785,"children":786},{"class":505,"line":533},[787],{"type":44,"tag":503,"props":788,"children":789},{},[790],{"type":50,"value":791},"        argMax(content, inserted_at) as content,\n",{"type":44,"tag":503,"props":793,"children":795},{"class":505,"line":794},5,[796],{"type":44,"tag":503,"props":797,"children":798},{},[799],{"type":50,"value":800},"        argMax(metadata.report_id, inserted_at) as report_id,\n",{"type":44,"tag":503,"props":802,"children":804},{"class":505,"line":803},6,[805],{"type":44,"tag":503,"props":806,"children":807},{},[808],{"type":50,"value":809},"        argMax(metadata.source_product, inserted_at) as source_product,\n",{"type":44,"tag":503,"props":811,"children":813},{"class":505,"line":812},7,[814],{"type":44,"tag":503,"props":815,"children":816},{},[817],{"type":50,"value":818},"        argMax(metadata.source_type, inserted_at) as source_type,\n",{"type":44,"tag":503,"props":820,"children":822},{"class":505,"line":821},8,[823],{"type":44,"tag":503,"props":824,"children":825},{},[826],{"type":50,"value":827},"        argMax(metadata.deleted, inserted_at) as deleted,\n",{"type":44,"tag":503,"props":829,"children":831},{"class":505,"line":830},9,[832],{"type":44,"tag":503,"props":833,"children":834},{},[835],{"type":50,"value":836},"        argMax(embedding, inserted_at) as embedding,\n",{"type":44,"tag":503,"props":838,"children":840},{"class":505,"line":839},10,[841],{"type":44,"tag":503,"props":842,"children":843},{},[844],{"type":50,"value":845},"        argMax(timestamp, inserted_at) as signal_ts\n",{"type":44,"tag":503,"props":847,"children":848},{"class":505,"line":27},[849],{"type":44,"tag":503,"props":850,"children":851},{},[852],{"type":50,"value":853},"    FROM document_embeddings\n",{"type":44,"tag":503,"props":855,"children":857},{"class":505,"line":856},12,[858],{"type":44,"tag":503,"props":859,"children":860},{},[861],{"type":50,"value":862},"    WHERE model_name = 'text-embedding-3-small-1536'\n",{"type":44,"tag":503,"props":864,"children":866},{"class":505,"line":865},13,[867],{"type":44,"tag":503,"props":868,"children":869},{},[870],{"type":50,"value":871},"      AND product = 'signals'\n",{"type":44,"tag":503,"props":873,"children":875},{"class":505,"line":874},14,[876],{"type":44,"tag":503,"props":877,"children":878},{},[879],{"type":50,"value":880},"      AND document_type = 'signal'\n",{"type":44,"tag":503,"props":882,"children":884},{"class":505,"line":883},15,[885],{"type":44,"tag":503,"props":886,"children":887},{},[888],{"type":50,"value":889},"      AND timestamp >= now() - INTERVAL 1 MONTH\n",{"type":44,"tag":503,"props":891,"children":893},{"class":505,"line":892},16,[894],{"type":44,"tag":503,"props":895,"children":896},{},[897],{"type":50,"value":898},"    GROUP BY document_id\n",{"type":44,"tag":503,"props":900,"children":902},{"class":505,"line":901},17,[903],{"type":44,"tag":503,"props":904,"children":905},{},[906],{"type":50,"value":907},")\n",{"type":44,"tag":503,"props":909,"children":911},{"class":505,"line":910},18,[912],{"type":44,"tag":503,"props":913,"children":914},{},[915],{"type":50,"value":916},"WHERE deleted != 'true'\n",{"type":44,"tag":60,"props":918,"children":919},{},[920,922,927],{"type":50,"value":921},"Only select the ",{"type":44,"tag":84,"props":923,"children":925},{"className":924},[],[926],{"type":50,"value":470},{"type":50,"value":928}," column in the inner subquery when you actually need it for similarity searches — it's a 1536-element float array and expensive to materialize otherwise.",{"type":44,"tag":53,"props":930,"children":932},{"id":931},"the-embedtext-function",[933,934,940],{"type":50,"value":544},{"type":44,"tag":84,"props":935,"children":937},{"className":936},[],[938],{"type":50,"value":939},"embedText()",{"type":50,"value":941}," Function",{"type":44,"tag":60,"props":943,"children":944},{},[945,950],{"type":44,"tag":84,"props":946,"children":948},{"className":947},[],[949],{"type":50,"value":939},{"type":50,"value":951}," is a HogQL function that converts a text string into an embedding vector at query compile time. It calls the embedding API and inlines the resulting vector as a constant before executing the query. This means you can do semantic search in a single query without any external embedding step.",{"type":44,"tag":60,"props":953,"children":954},{},[955,960,962],{"type":44,"tag":71,"props":956,"children":957},{},[958],{"type":50,"value":959},"Signature:",{"type":50,"value":961}," ",{"type":44,"tag":84,"props":963,"children":965},{"className":964},[],[966],{"type":50,"value":967},"embedText(text, model_name)",{"type":44,"tag":118,"props":969,"children":970},{},[971,988],{"type":44,"tag":122,"props":972,"children":973},{},[974,979,981,986],{"type":44,"tag":84,"props":975,"children":977},{"className":976},[],[978],{"type":50,"value":50},{"type":50,"value":980}," — the string to embed. ",{"type":44,"tag":71,"props":982,"children":983},{},[984],{"type":50,"value":985},"Must be a string literal",{"type":50,"value":987},", not a column reference.",{"type":44,"tag":122,"props":989,"children":990},{},[991,996,998],{"type":44,"tag":84,"props":992,"children":994},{"className":993},[],[995],{"type":50,"value":337},{"type":50,"value":997}," — the embedding model to use. ",{"type":44,"tag":71,"props":999,"children":1000},{},[1001,1003,1008],{"type":50,"value":1002},"For signals, always use ",{"type":44,"tag":84,"props":1004,"children":1006},{"className":1005},[],[1007],{"type":50,"value":352},{"type":50,"value":645},{"type":44,"tag":60,"props":1010,"children":1011},{},[1012],{"type":50,"value":1013},"Both arguments must be literal strings. You cannot pass column values or expressions — the function resolves at compile time, not per row.",{"type":44,"tag":53,"props":1015,"children":1017},{"id":1016},"cosinedistance-for-similarity-search",[1018,1024],{"type":44,"tag":84,"props":1019,"children":1021},{"className":1020},[],[1022],{"type":50,"value":1023},"cosineDistance()",{"type":50,"value":1025}," for Similarity Search",{"type":44,"tag":60,"props":1027,"children":1028},{},[1029,1031,1037,1039,1045,1047,1053],{"type":50,"value":1030},"Use ",{"type":44,"tag":84,"props":1032,"children":1034},{"className":1033},[],[1035],{"type":50,"value":1036},"cosineDistance(embedding, ...)",{"type":50,"value":1038}," to rank signals by semantic similarity. Lower values = more similar. Always ",{"type":44,"tag":84,"props":1040,"children":1042},{"className":1041},[],[1043],{"type":50,"value":1044},"ORDER BY distance ASC",{"type":50,"value":1046}," and add a ",{"type":44,"tag":84,"props":1048,"children":1050},{"className":1049},[],[1051],{"type":50,"value":1052},"LIMIT",{"type":50,"value":645},{"type":44,"tag":493,"props":1055,"children":1057},{"className":495,"code":1056,"language":22,"meta":497,"style":497},"cosineDistance(embedding, embedText('your search text', 'text-embedding-3-small-1536')) as distance\n",[1058],{"type":44,"tag":84,"props":1059,"children":1060},{"__ignoreMap":497},[1061],{"type":44,"tag":503,"props":1062,"children":1063},{"class":505,"line":506},[1064],{"type":44,"tag":503,"props":1065,"children":1066},{},[1067],{"type":50,"value":1056},{"type":44,"tag":60,"props":1069,"children":1070},{},[1071,1073,1079],{"type":50,"value":1072},"The embedding model (",{"type":44,"tag":84,"props":1074,"children":1076},{"className":1075},[],[1077],{"type":50,"value":1078},"text-embedding-3-small-1536",{"type":50,"value":1080},") uses matryoshka representation learning, so the embedding dimensions are ordered by importance. This means similarity search works well even at high dimensionality — the curse of dimensionality is not a significant concern here.",{"type":44,"tag":53,"props":1082,"children":1084},{"id":1083},"metadata-json-fields",[1085],{"type":50,"value":1086},"Metadata JSON Fields",{"type":44,"tag":60,"props":1088,"children":1089},{},[1090,1091,1096,1098,1103,1105,1110,1112,1117],{"type":50,"value":544},{"type":44,"tag":84,"props":1092,"children":1094},{"className":1093},[],[1095],{"type":50,"value":449},{"type":50,"value":1097}," column is a JSON string. HogQL supports ",{"type":44,"tag":84,"props":1099,"children":1101},{"className":1100},[],[1102],{"type":50,"value":661},{"type":50,"value":1104}," dot access ",{"type":44,"tag":71,"props":1106,"children":1107},{},[1108],{"type":50,"value":1109},"only on the raw table column",{"type":50,"value":1111},". After aggregation (e.g. ",{"type":44,"tag":84,"props":1113,"children":1115},{"className":1114},[],[1116],{"type":50,"value":691},{"type":50,"value":1118},"), the JSON type is lost and dot access will fail. Always extract the fields you need inside the dedup subquery.",{"type":44,"tag":236,"props":1120,"children":1121},{},[1122,1142],{"type":44,"tag":240,"props":1123,"children":1124},{},[1125],{"type":44,"tag":244,"props":1126,"children":1127},{},[1128,1133,1138],{"type":44,"tag":248,"props":1129,"children":1130},{},[1131],{"type":50,"value":1132},"Field",{"type":44,"tag":248,"props":1134,"children":1135},{},[1136],{"type":50,"value":1137},"Inner-query access",{"type":44,"tag":248,"props":1139,"children":1140},{},[1141],{"type":50,"value":262},{"type":44,"tag":264,"props":1143,"children":1144},{},[1145,1170,1196,1222,1248,1274,1306,1332],{"type":44,"tag":244,"props":1146,"children":1147},{},[1148,1156,1165],{"type":44,"tag":271,"props":1149,"children":1150},{},[1151],{"type":44,"tag":84,"props":1152,"children":1154},{"className":1153},[],[1155],{"type":50,"value":206},{"type":44,"tag":271,"props":1157,"children":1158},{},[1159],{"type":44,"tag":84,"props":1160,"children":1162},{"className":1161},[],[1163],{"type":50,"value":1164},"metadata.report_id",{"type":44,"tag":271,"props":1166,"children":1167},{},[1168],{"type":50,"value":1169},"UUID of the parent Signal Report (empty if unassigned)",{"type":44,"tag":244,"props":1171,"children":1172},{},[1173,1182,1191],{"type":44,"tag":271,"props":1174,"children":1175},{},[1176],{"type":44,"tag":84,"props":1177,"children":1179},{"className":1178},[],[1180],{"type":50,"value":1181},"source_product",{"type":44,"tag":271,"props":1183,"children":1184},{},[1185],{"type":44,"tag":84,"props":1186,"children":1188},{"className":1187},[],[1189],{"type":50,"value":1190},"metadata.source_product",{"type":44,"tag":271,"props":1192,"children":1193},{},[1194],{"type":50,"value":1195},"Originating product (use Example 3 to discover available values)",{"type":44,"tag":244,"props":1197,"children":1198},{},[1199,1208,1217],{"type":44,"tag":271,"props":1200,"children":1201},{},[1202],{"type":44,"tag":84,"props":1203,"children":1205},{"className":1204},[],[1206],{"type":50,"value":1207},"source_type",{"type":44,"tag":271,"props":1209,"children":1210},{},[1211],{"type":44,"tag":84,"props":1212,"children":1214},{"className":1213},[],[1215],{"type":50,"value":1216},"metadata.source_type",{"type":44,"tag":271,"props":1218,"children":1219},{},[1220],{"type":50,"value":1221},"Signal type (use Example 3 to discover available values)",{"type":44,"tag":244,"props":1223,"children":1224},{},[1225,1234,1243],{"type":44,"tag":271,"props":1226,"children":1227},{},[1228],{"type":44,"tag":84,"props":1229,"children":1231},{"className":1230},[],[1232],{"type":50,"value":1233},"source_id",{"type":44,"tag":271,"props":1235,"children":1236},{},[1237],{"type":44,"tag":84,"props":1238,"children":1240},{"className":1239},[],[1241],{"type":50,"value":1242},"metadata.source_id",{"type":44,"tag":271,"props":1244,"children":1245},{},[1246],{"type":50,"value":1247},"ID of the source entity",{"type":44,"tag":244,"props":1249,"children":1250},{},[1251,1260,1269],{"type":44,"tag":271,"props":1252,"children":1253},{},[1254],{"type":44,"tag":84,"props":1255,"children":1257},{"className":1256},[],[1258],{"type":50,"value":1259},"weight",{"type":44,"tag":271,"props":1261,"children":1262},{},[1263],{"type":44,"tag":84,"props":1264,"children":1266},{"className":1265},[],[1267],{"type":50,"value":1268},"metadata.weight",{"type":44,"tag":271,"props":1270,"children":1271},{},[1272],{"type":50,"value":1273},"Signal weight (contributes to report promotion threshold)",{"type":44,"tag":244,"props":1275,"children":1276},{},[1277,1286,1294],{"type":44,"tag":271,"props":1278,"children":1279},{},[1280],{"type":44,"tag":84,"props":1281,"children":1283},{"className":1282},[],[1284],{"type":50,"value":1285},"deleted",{"type":44,"tag":271,"props":1287,"children":1288},{},[1289],{"type":44,"tag":84,"props":1290,"children":1292},{"className":1291},[],[1293],{"type":50,"value":712},{"type":44,"tag":271,"props":1295,"children":1296},{},[1297,1299,1305],{"type":50,"value":1298},"Soft-deletion flag (extracted as String — compare with ",{"type":44,"tag":84,"props":1300,"children":1302},{"className":1301},[],[1303],{"type":50,"value":1304},"!= 'true'",{"type":50,"value":179},{"type":44,"tag":244,"props":1307,"children":1308},{},[1309,1318,1327],{"type":44,"tag":271,"props":1310,"children":1311},{},[1312],{"type":44,"tag":84,"props":1313,"children":1315},{"className":1314},[],[1316],{"type":50,"value":1317},"extra",{"type":44,"tag":271,"props":1319,"children":1320},{},[1321],{"type":44,"tag":84,"props":1322,"children":1324},{"className":1323},[],[1325],{"type":50,"value":1326},"metadata.extra",{"type":44,"tag":271,"props":1328,"children":1329},{},[1330],{"type":50,"value":1331},"Arbitrary JSON blob from the source product",{"type":44,"tag":244,"props":1333,"children":1334},{},[1335,1344,1353],{"type":44,"tag":271,"props":1336,"children":1337},{},[1338],{"type":44,"tag":84,"props":1339,"children":1341},{"className":1340},[],[1342],{"type":50,"value":1343},"match_metadata",{"type":44,"tag":271,"props":1345,"children":1346},{},[1347],{"type":44,"tag":84,"props":1348,"children":1350},{"className":1349},[],[1351],{"type":50,"value":1352},"metadata.match_metadata",{"type":44,"tag":271,"props":1354,"children":1355},{},[1356],{"type":50,"value":1357},"LLM match reasoning stored during grouping",{"type":44,"tag":1359,"props":1360,"children":1361},"hr",{},[],{"type":44,"tag":53,"props":1363,"children":1365},{"id":1364},"example-1-semantic-search-for-signals",[1366],{"type":50,"value":1367},"Example 1: Semantic Search for Signals",{"type":44,"tag":60,"props":1369,"children":1370},{},[1371],{"type":50,"value":1372},"Find signals most similar to a natural-language query. This is the most useful query for understanding what's happening in a customer's product:",{"type":44,"tag":493,"props":1374,"children":1376},{"className":495,"code":1375,"language":22,"meta":497,"style":497},"SELECT\n    document_id,\n    content,\n    report_id,\n    source_product,\n    source_type,\n    cosineDistance(embedding, embedText('users seeing errors on checkout page', 'text-embedding-3-small-1536')) as distance\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(embedding, inserted_at) as embedding,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\nORDER BY distance ASC\nLIMIT 10\n",[1377],{"type":44,"tag":84,"props":1378,"children":1379},{"__ignoreMap":497},[1380,1388,1396,1404,1412,1420,1428,1436,1444,1451,1458,1465,1472,1479,1486,1493,1500,1507,1514,1522,1530,1538,1546,1554,1562,1570,1579],{"type":44,"tag":503,"props":1381,"children":1382},{"class":505,"line":506},[1383],{"type":44,"tag":503,"props":1384,"children":1385},{},[1386],{"type":50,"value":1387},"SELECT\n",{"type":44,"tag":503,"props":1389,"children":1390},{"class":505,"line":515},[1391],{"type":44,"tag":503,"props":1392,"children":1393},{},[1394],{"type":50,"value":1395},"    document_id,\n",{"type":44,"tag":503,"props":1397,"children":1398},{"class":505,"line":524},[1399],{"type":44,"tag":503,"props":1400,"children":1401},{},[1402],{"type":50,"value":1403},"    content,\n",{"type":44,"tag":503,"props":1405,"children":1406},{"class":505,"line":533},[1407],{"type":44,"tag":503,"props":1408,"children":1409},{},[1410],{"type":50,"value":1411},"    report_id,\n",{"type":44,"tag":503,"props":1413,"children":1414},{"class":505,"line":794},[1415],{"type":44,"tag":503,"props":1416,"children":1417},{},[1418],{"type":50,"value":1419},"    source_product,\n",{"type":44,"tag":503,"props":1421,"children":1422},{"class":505,"line":803},[1423],{"type":44,"tag":503,"props":1424,"children":1425},{},[1426],{"type":50,"value":1427},"    source_type,\n",{"type":44,"tag":503,"props":1429,"children":1430},{"class":505,"line":812},[1431],{"type":44,"tag":503,"props":1432,"children":1433},{},[1434],{"type":50,"value":1435},"    cosineDistance(embedding, embedText('users seeing errors on checkout page', 'text-embedding-3-small-1536')) as distance\n",{"type":44,"tag":503,"props":1437,"children":1438},{"class":505,"line":821},[1439],{"type":44,"tag":503,"props":1440,"children":1441},{},[1442],{"type":50,"value":1443},"FROM (\n",{"type":44,"tag":503,"props":1445,"children":1446},{"class":505,"line":830},[1447],{"type":44,"tag":503,"props":1448,"children":1449},{},[1450],{"type":50,"value":775},{"type":44,"tag":503,"props":1452,"children":1453},{"class":505,"line":839},[1454],{"type":44,"tag":503,"props":1455,"children":1456},{},[1457],{"type":50,"value":783},{"type":44,"tag":503,"props":1459,"children":1460},{"class":505,"line":27},[1461],{"type":44,"tag":503,"props":1462,"children":1463},{},[1464],{"type":50,"value":791},{"type":44,"tag":503,"props":1466,"children":1467},{"class":505,"line":856},[1468],{"type":44,"tag":503,"props":1469,"children":1470},{},[1471],{"type":50,"value":800},{"type":44,"tag":503,"props":1473,"children":1474},{"class":505,"line":865},[1475],{"type":44,"tag":503,"props":1476,"children":1477},{},[1478],{"type":50,"value":809},{"type":44,"tag":503,"props":1480,"children":1481},{"class":505,"line":874},[1482],{"type":44,"tag":503,"props":1483,"children":1484},{},[1485],{"type":50,"value":818},{"type":44,"tag":503,"props":1487,"children":1488},{"class":505,"line":883},[1489],{"type":44,"tag":503,"props":1490,"children":1491},{},[1492],{"type":50,"value":827},{"type":44,"tag":503,"props":1494,"children":1495},{"class":505,"line":892},[1496],{"type":44,"tag":503,"props":1497,"children":1498},{},[1499],{"type":50,"value":836},{"type":44,"tag":503,"props":1501,"children":1502},{"class":505,"line":901},[1503],{"type":44,"tag":503,"props":1504,"children":1505},{},[1506],{"type":50,"value":845},{"type":44,"tag":503,"props":1508,"children":1509},{"class":505,"line":910},[1510],{"type":44,"tag":503,"props":1511,"children":1512},{},[1513],{"type":50,"value":853},{"type":44,"tag":503,"props":1515,"children":1517},{"class":505,"line":1516},19,[1518],{"type":44,"tag":503,"props":1519,"children":1520},{},[1521],{"type":50,"value":862},{"type":44,"tag":503,"props":1523,"children":1525},{"class":505,"line":1524},20,[1526],{"type":44,"tag":503,"props":1527,"children":1528},{},[1529],{"type":50,"value":871},{"type":44,"tag":503,"props":1531,"children":1533},{"class":505,"line":1532},21,[1534],{"type":44,"tag":503,"props":1535,"children":1536},{},[1537],{"type":50,"value":880},{"type":44,"tag":503,"props":1539,"children":1541},{"class":505,"line":1540},22,[1542],{"type":44,"tag":503,"props":1543,"children":1544},{},[1545],{"type":50,"value":889},{"type":44,"tag":503,"props":1547,"children":1549},{"class":505,"line":1548},23,[1550],{"type":44,"tag":503,"props":1551,"children":1552},{},[1553],{"type":50,"value":898},{"type":44,"tag":503,"props":1555,"children":1557},{"class":505,"line":1556},24,[1558],{"type":44,"tag":503,"props":1559,"children":1560},{},[1561],{"type":50,"value":907},{"type":44,"tag":503,"props":1563,"children":1565},{"class":505,"line":1564},25,[1566],{"type":44,"tag":503,"props":1567,"children":1568},{},[1569],{"type":50,"value":916},{"type":44,"tag":503,"props":1571,"children":1573},{"class":505,"line":1572},26,[1574],{"type":44,"tag":503,"props":1575,"children":1576},{},[1577],{"type":50,"value":1578},"ORDER BY distance ASC\n",{"type":44,"tag":503,"props":1580,"children":1582},{"class":505,"line":1581},27,[1583],{"type":44,"tag":503,"props":1584,"children":1585},{},[1586],{"type":50,"value":1587},"LIMIT 10\n",{"type":44,"tag":60,"props":1589,"children":1590},{},[1591,1593,1599],{"type":50,"value":1592},"Adjust the ",{"type":44,"tag":84,"props":1594,"children":1596},{"className":1595},[],[1597],{"type":50,"value":1598},"embedText",{"type":50,"value":1600}," first argument to whatever you're looking for. Write it as a natural-language description of the kind of issue or observation you want to find.",{"type":44,"tag":60,"props":1602,"children":1603},{},[1604,1606,1612],{"type":50,"value":1605},"To restrict to signals that have already been grouped into a report, add ",{"type":44,"tag":84,"props":1607,"children":1609},{"className":1608},[],[1610],{"type":50,"value":1611},"AND report_id != ''",{"type":50,"value":1613}," to the outer WHERE.",{"type":44,"tag":53,"props":1615,"children":1617},{"id":1616},"example-2-fetch-all-signals-for-a-specific-report",[1618],{"type":50,"value":1619},"Example 2: Fetch All Signals for a Specific Report",{"type":44,"tag":60,"props":1621,"children":1622},{},[1623,1625,1630],{"type":50,"value":1624},"Once you have a ",{"type":44,"tag":84,"props":1626,"children":1628},{"className":1627},[],[1629],{"type":50,"value":206},{"type":50,"value":1631}," (from a semantic search or from the Signal Reports API), fetch all signals belonging to that report:",{"type":44,"tag":493,"props":1633,"children":1635},{"className":495,"code":1634,"language":22,"meta":497,"style":497},"SELECT\n    document_id,\n    content,\n    report_id,\n    source_product,\n    source_type,\n    signal_ts\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 3 MONTH\n    GROUP BY document_id\n)\nWHERE report_id = '\u003Creport-uuid-here>'\n  AND deleted != 'true'\nORDER BY signal_ts ASC\nLIMIT 100\n",[1636],{"type":44,"tag":84,"props":1637,"children":1638},{"__ignoreMap":497},[1639,1646,1653,1660,1667,1674,1681,1689,1696,1703,1710,1717,1724,1731,1738,1745,1752,1759,1766,1773,1780,1788,1795,1802,1810,1818,1826],{"type":44,"tag":503,"props":1640,"children":1641},{"class":505,"line":506},[1642],{"type":44,"tag":503,"props":1643,"children":1644},{},[1645],{"type":50,"value":1387},{"type":44,"tag":503,"props":1647,"children":1648},{"class":505,"line":515},[1649],{"type":44,"tag":503,"props":1650,"children":1651},{},[1652],{"type":50,"value":1395},{"type":44,"tag":503,"props":1654,"children":1655},{"class":505,"line":524},[1656],{"type":44,"tag":503,"props":1657,"children":1658},{},[1659],{"type":50,"value":1403},{"type":44,"tag":503,"props":1661,"children":1662},{"class":505,"line":533},[1663],{"type":44,"tag":503,"props":1664,"children":1665},{},[1666],{"type":50,"value":1411},{"type":44,"tag":503,"props":1668,"children":1669},{"class":505,"line":794},[1670],{"type":44,"tag":503,"props":1671,"children":1672},{},[1673],{"type":50,"value":1419},{"type":44,"tag":503,"props":1675,"children":1676},{"class":505,"line":803},[1677],{"type":44,"tag":503,"props":1678,"children":1679},{},[1680],{"type":50,"value":1427},{"type":44,"tag":503,"props":1682,"children":1683},{"class":505,"line":812},[1684],{"type":44,"tag":503,"props":1685,"children":1686},{},[1687],{"type":50,"value":1688},"    signal_ts\n",{"type":44,"tag":503,"props":1690,"children":1691},{"class":505,"line":821},[1692],{"type":44,"tag":503,"props":1693,"children":1694},{},[1695],{"type":50,"value":1443},{"type":44,"tag":503,"props":1697,"children":1698},{"class":505,"line":830},[1699],{"type":44,"tag":503,"props":1700,"children":1701},{},[1702],{"type":50,"value":775},{"type":44,"tag":503,"props":1704,"children":1705},{"class":505,"line":839},[1706],{"type":44,"tag":503,"props":1707,"children":1708},{},[1709],{"type":50,"value":783},{"type":44,"tag":503,"props":1711,"children":1712},{"class":505,"line":27},[1713],{"type":44,"tag":503,"props":1714,"children":1715},{},[1716],{"type":50,"value":791},{"type":44,"tag":503,"props":1718,"children":1719},{"class":505,"line":856},[1720],{"type":44,"tag":503,"props":1721,"children":1722},{},[1723],{"type":50,"value":800},{"type":44,"tag":503,"props":1725,"children":1726},{"class":505,"line":865},[1727],{"type":44,"tag":503,"props":1728,"children":1729},{},[1730],{"type":50,"value":809},{"type":44,"tag":503,"props":1732,"children":1733},{"class":505,"line":874},[1734],{"type":44,"tag":503,"props":1735,"children":1736},{},[1737],{"type":50,"value":818},{"type":44,"tag":503,"props":1739,"children":1740},{"class":505,"line":883},[1741],{"type":44,"tag":503,"props":1742,"children":1743},{},[1744],{"type":50,"value":827},{"type":44,"tag":503,"props":1746,"children":1747},{"class":505,"line":892},[1748],{"type":44,"tag":503,"props":1749,"children":1750},{},[1751],{"type":50,"value":845},{"type":44,"tag":503,"props":1753,"children":1754},{"class":505,"line":901},[1755],{"type":44,"tag":503,"props":1756,"children":1757},{},[1758],{"type":50,"value":853},{"type":44,"tag":503,"props":1760,"children":1761},{"class":505,"line":910},[1762],{"type":44,"tag":503,"props":1763,"children":1764},{},[1765],{"type":50,"value":862},{"type":44,"tag":503,"props":1767,"children":1768},{"class":505,"line":1516},[1769],{"type":44,"tag":503,"props":1770,"children":1771},{},[1772],{"type":50,"value":871},{"type":44,"tag":503,"props":1774,"children":1775},{"class":505,"line":1524},[1776],{"type":44,"tag":503,"props":1777,"children":1778},{},[1779],{"type":50,"value":880},{"type":44,"tag":503,"props":1781,"children":1782},{"class":505,"line":1532},[1783],{"type":44,"tag":503,"props":1784,"children":1785},{},[1786],{"type":50,"value":1787},"      AND timestamp >= now() - INTERVAL 3 MONTH\n",{"type":44,"tag":503,"props":1789,"children":1790},{"class":505,"line":1540},[1791],{"type":44,"tag":503,"props":1792,"children":1793},{},[1794],{"type":50,"value":898},{"type":44,"tag":503,"props":1796,"children":1797},{"class":505,"line":1548},[1798],{"type":44,"tag":503,"props":1799,"children":1800},{},[1801],{"type":50,"value":907},{"type":44,"tag":503,"props":1803,"children":1804},{"class":505,"line":1556},[1805],{"type":44,"tag":503,"props":1806,"children":1807},{},[1808],{"type":50,"value":1809},"WHERE report_id = '\u003Creport-uuid-here>'\n",{"type":44,"tag":503,"props":1811,"children":1812},{"class":505,"line":1564},[1813],{"type":44,"tag":503,"props":1814,"children":1815},{},[1816],{"type":50,"value":1817},"  AND deleted != 'true'\n",{"type":44,"tag":503,"props":1819,"children":1820},{"class":505,"line":1572},[1821],{"type":44,"tag":503,"props":1822,"children":1823},{},[1824],{"type":50,"value":1825},"ORDER BY signal_ts ASC\n",{"type":44,"tag":503,"props":1827,"children":1828},{"class":505,"line":1581},[1829],{"type":44,"tag":503,"props":1830,"children":1831},{},[1832],{"type":50,"value":1833},"LIMIT 100\n",{"type":44,"tag":53,"props":1835,"children":1837},{"id":1836},"example-3-list-signal-types",[1838],{"type":50,"value":1839},"Example 3: List Signal Types",{"type":44,"tag":60,"props":1841,"children":1842},{},[1843,1845,1851],{"type":50,"value":1844},"See what kinds of signals exist for this customer — returns one example per unique ",{"type":44,"tag":84,"props":1846,"children":1848},{"className":1847},[],[1849],{"type":50,"value":1850},"(source_product, source_type)",{"type":50,"value":1852}," pair from the last month:",{"type":44,"tag":493,"props":1854,"children":1856},{"className":495,"code":1855,"language":22,"meta":497,"style":497},"SELECT\n    source_product,\n    source_type,\n    count() as cnt,\n    max(signal_ts) as latest_timestamp\nFROM (\n    SELECT\n        document_id,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\nGROUP BY source_product, source_type\nORDER BY latest_timestamp DESC\nLIMIT 100\n",[1857],{"type":44,"tag":84,"props":1858,"children":1859},{"__ignoreMap":497},[1860,1867,1874,1881,1889,1897,1904,1911,1918,1925,1932,1939,1946,1953,1960,1967,1974,1981,1988,1995,2002,2009,2017,2025],{"type":44,"tag":503,"props":1861,"children":1862},{"class":505,"line":506},[1863],{"type":44,"tag":503,"props":1864,"children":1865},{},[1866],{"type":50,"value":1387},{"type":44,"tag":503,"props":1868,"children":1869},{"class":505,"line":515},[1870],{"type":44,"tag":503,"props":1871,"children":1872},{},[1873],{"type":50,"value":1419},{"type":44,"tag":503,"props":1875,"children":1876},{"class":505,"line":524},[1877],{"type":44,"tag":503,"props":1878,"children":1879},{},[1880],{"type":50,"value":1427},{"type":44,"tag":503,"props":1882,"children":1883},{"class":505,"line":533},[1884],{"type":44,"tag":503,"props":1885,"children":1886},{},[1887],{"type":50,"value":1888},"    count() as cnt,\n",{"type":44,"tag":503,"props":1890,"children":1891},{"class":505,"line":794},[1892],{"type":44,"tag":503,"props":1893,"children":1894},{},[1895],{"type":50,"value":1896},"    max(signal_ts) as latest_timestamp\n",{"type":44,"tag":503,"props":1898,"children":1899},{"class":505,"line":803},[1900],{"type":44,"tag":503,"props":1901,"children":1902},{},[1903],{"type":50,"value":1443},{"type":44,"tag":503,"props":1905,"children":1906},{"class":505,"line":812},[1907],{"type":44,"tag":503,"props":1908,"children":1909},{},[1910],{"type":50,"value":775},{"type":44,"tag":503,"props":1912,"children":1913},{"class":505,"line":821},[1914],{"type":44,"tag":503,"props":1915,"children":1916},{},[1917],{"type":50,"value":783},{"type":44,"tag":503,"props":1919,"children":1920},{"class":505,"line":830},[1921],{"type":44,"tag":503,"props":1922,"children":1923},{},[1924],{"type":50,"value":809},{"type":44,"tag":503,"props":1926,"children":1927},{"class":505,"line":839},[1928],{"type":44,"tag":503,"props":1929,"children":1930},{},[1931],{"type":50,"value":809},{"type":44,"tag":503,"props":1933,"children":1934},{"class":505,"line":27},[1935],{"type":44,"tag":503,"props":1936,"children":1937},{},[1938],{"type":50,"value":818},{"type":44,"tag":503,"props":1940,"children":1941},{"class":505,"line":856},[1942],{"type":44,"tag":503,"props":1943,"children":1944},{},[1945],{"type":50,"value":827},{"type":44,"tag":503,"props":1947,"children":1948},{"class":505,"line":865},[1949],{"type":44,"tag":503,"props":1950,"children":1951},{},[1952],{"type":50,"value":845},{"type":44,"tag":503,"props":1954,"children":1955},{"class":505,"line":874},[1956],{"type":44,"tag":503,"props":1957,"children":1958},{},[1959],{"type":50,"value":853},{"type":44,"tag":503,"props":1961,"children":1962},{"class":505,"line":883},[1963],{"type":44,"tag":503,"props":1964,"children":1965},{},[1966],{"type":50,"value":862},{"type":44,"tag":503,"props":1968,"children":1969},{"class":505,"line":892},[1970],{"type":44,"tag":503,"props":1971,"children":1972},{},[1973],{"type":50,"value":871},{"type":44,"tag":503,"props":1975,"children":1976},{"class":505,"line":901},[1977],{"type":44,"tag":503,"props":1978,"children":1979},{},[1980],{"type":50,"value":880},{"type":44,"tag":503,"props":1982,"children":1983},{"class":505,"line":910},[1984],{"type":44,"tag":503,"props":1985,"children":1986},{},[1987],{"type":50,"value":889},{"type":44,"tag":503,"props":1989,"children":1990},{"class":505,"line":1516},[1991],{"type":44,"tag":503,"props":1992,"children":1993},{},[1994],{"type":50,"value":898},{"type":44,"tag":503,"props":1996,"children":1997},{"class":505,"line":1524},[1998],{"type":44,"tag":503,"props":1999,"children":2000},{},[2001],{"type":50,"value":907},{"type":44,"tag":503,"props":2003,"children":2004},{"class":505,"line":1532},[2005],{"type":44,"tag":503,"props":2006,"children":2007},{},[2008],{"type":50,"value":916},{"type":44,"tag":503,"props":2010,"children":2011},{"class":505,"line":1540},[2012],{"type":44,"tag":503,"props":2013,"children":2014},{},[2015],{"type":50,"value":2016},"GROUP BY source_product, source_type\n",{"type":44,"tag":503,"props":2018,"children":2019},{"class":505,"line":1548},[2020],{"type":44,"tag":503,"props":2021,"children":2022},{},[2023],{"type":50,"value":2024},"ORDER BY latest_timestamp DESC\n",{"type":44,"tag":503,"props":2026,"children":2027},{"class":505,"line":1556},[2028],{"type":44,"tag":503,"props":2029,"children":2030},{},[2031],{"type":50,"value":1833},{"type":44,"tag":53,"props":2033,"children":2035},{"id":2034},"example-4-recent-signals-from-a-specific-source",[2036],{"type":50,"value":2037},"Example 4: Recent Signals from a Specific Source",{"type":44,"tag":60,"props":2039,"children":2040},{},[2041],{"type":50,"value":2042},"Find the latest signals from a particular product source (e.g. all error tracking signals):",{"type":44,"tag":493,"props":2044,"children":2046},{"className":495,"code":2045,"language":22,"meta":497,"style":497},"SELECT\n    document_id,\n    content,\n    source_type,\n    report_id,\n    signal_ts\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.report_id, inserted_at) as report_id,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 WEEK\n    GROUP BY document_id\n)\nWHERE source_product = 'error_tracking'\n  AND deleted != 'true'\nORDER BY signal_ts DESC\nLIMIT 100\n",[2047],{"type":44,"tag":84,"props":2048,"children":2049},{"__ignoreMap":497},[2050,2057,2064,2071,2078,2085,2092,2099,2106,2113,2120,2127,2134,2141,2148,2155,2162,2169,2176,2183,2191,2198,2205,2213,2220,2228],{"type":44,"tag":503,"props":2051,"children":2052},{"class":505,"line":506},[2053],{"type":44,"tag":503,"props":2054,"children":2055},{},[2056],{"type":50,"value":1387},{"type":44,"tag":503,"props":2058,"children":2059},{"class":505,"line":515},[2060],{"type":44,"tag":503,"props":2061,"children":2062},{},[2063],{"type":50,"value":1395},{"type":44,"tag":503,"props":2065,"children":2066},{"class":505,"line":524},[2067],{"type":44,"tag":503,"props":2068,"children":2069},{},[2070],{"type":50,"value":1403},{"type":44,"tag":503,"props":2072,"children":2073},{"class":505,"line":533},[2074],{"type":44,"tag":503,"props":2075,"children":2076},{},[2077],{"type":50,"value":1427},{"type":44,"tag":503,"props":2079,"children":2080},{"class":505,"line":794},[2081],{"type":44,"tag":503,"props":2082,"children":2083},{},[2084],{"type":50,"value":1411},{"type":44,"tag":503,"props":2086,"children":2087},{"class":505,"line":803},[2088],{"type":44,"tag":503,"props":2089,"children":2090},{},[2091],{"type":50,"value":1688},{"type":44,"tag":503,"props":2093,"children":2094},{"class":505,"line":812},[2095],{"type":44,"tag":503,"props":2096,"children":2097},{},[2098],{"type":50,"value":1443},{"type":44,"tag":503,"props":2100,"children":2101},{"class":505,"line":821},[2102],{"type":44,"tag":503,"props":2103,"children":2104},{},[2105],{"type":50,"value":775},{"type":44,"tag":503,"props":2107,"children":2108},{"class":505,"line":830},[2109],{"type":44,"tag":503,"props":2110,"children":2111},{},[2112],{"type":50,"value":783},{"type":44,"tag":503,"props":2114,"children":2115},{"class":505,"line":839},[2116],{"type":44,"tag":503,"props":2117,"children":2118},{},[2119],{"type":50,"value":791},{"type":44,"tag":503,"props":2121,"children":2122},{"class":505,"line":27},[2123],{"type":44,"tag":503,"props":2124,"children":2125},{},[2126],{"type":50,"value":809},{"type":44,"tag":503,"props":2128,"children":2129},{"class":505,"line":856},[2130],{"type":44,"tag":503,"props":2131,"children":2132},{},[2133],{"type":50,"value":818},{"type":44,"tag":503,"props":2135,"children":2136},{"class":505,"line":865},[2137],{"type":44,"tag":503,"props":2138,"children":2139},{},[2140],{"type":50,"value":800},{"type":44,"tag":503,"props":2142,"children":2143},{"class":505,"line":874},[2144],{"type":44,"tag":503,"props":2145,"children":2146},{},[2147],{"type":50,"value":827},{"type":44,"tag":503,"props":2149,"children":2150},{"class":505,"line":883},[2151],{"type":44,"tag":503,"props":2152,"children":2153},{},[2154],{"type":50,"value":845},{"type":44,"tag":503,"props":2156,"children":2157},{"class":505,"line":892},[2158],{"type":44,"tag":503,"props":2159,"children":2160},{},[2161],{"type":50,"value":853},{"type":44,"tag":503,"props":2163,"children":2164},{"class":505,"line":901},[2165],{"type":44,"tag":503,"props":2166,"children":2167},{},[2168],{"type":50,"value":862},{"type":44,"tag":503,"props":2170,"children":2171},{"class":505,"line":910},[2172],{"type":44,"tag":503,"props":2173,"children":2174},{},[2175],{"type":50,"value":871},{"type":44,"tag":503,"props":2177,"children":2178},{"class":505,"line":1516},[2179],{"type":44,"tag":503,"props":2180,"children":2181},{},[2182],{"type":50,"value":880},{"type":44,"tag":503,"props":2184,"children":2185},{"class":505,"line":1524},[2186],{"type":44,"tag":503,"props":2187,"children":2188},{},[2189],{"type":50,"value":2190},"      AND timestamp >= now() - INTERVAL 1 WEEK\n",{"type":44,"tag":503,"props":2192,"children":2193},{"class":505,"line":1532},[2194],{"type":44,"tag":503,"props":2195,"children":2196},{},[2197],{"type":50,"value":898},{"type":44,"tag":503,"props":2199,"children":2200},{"class":505,"line":1540},[2201],{"type":44,"tag":503,"props":2202,"children":2203},{},[2204],{"type":50,"value":907},{"type":44,"tag":503,"props":2206,"children":2207},{"class":505,"line":1548},[2208],{"type":44,"tag":503,"props":2209,"children":2210},{},[2211],{"type":50,"value":2212},"WHERE source_product = 'error_tracking'\n",{"type":44,"tag":503,"props":2214,"children":2215},{"class":505,"line":1556},[2216],{"type":44,"tag":503,"props":2217,"children":2218},{},[2219],{"type":50,"value":1817},{"type":44,"tag":503,"props":2221,"children":2222},{"class":505,"line":1564},[2223],{"type":44,"tag":503,"props":2224,"children":2225},{},[2226],{"type":50,"value":2227},"ORDER BY signal_ts DESC\n",{"type":44,"tag":503,"props":2229,"children":2230},{"class":505,"line":1572},[2231],{"type":44,"tag":503,"props":2232,"children":2233},{},[2234],{"type":50,"value":1833},{"type":44,"tag":60,"props":2236,"children":2237},{},[2238,2240,2246,2248,2254,2255,2261,2262,2268],{"type":50,"value":2239},"Replace ",{"type":44,"tag":84,"props":2241,"children":2243},{"className":2242},[],[2244],{"type":50,"value":2245},"'error_tracking'",{"type":50,"value":2247}," with any source product: ",{"type":44,"tag":84,"props":2249,"children":2251},{"className":2250},[],[2252],{"type":50,"value":2253},"'web_analytics'",{"type":50,"value":142},{"type":44,"tag":84,"props":2256,"children":2258},{"className":2257},[],[2259],{"type":50,"value":2260},"'experiments'",{"type":50,"value":142},{"type":44,"tag":84,"props":2263,"children":2265},{"className":2264},[],[2266],{"type":50,"value":2267},"'session_replay'",{"type":50,"value":2269},", etc. Use Example 3 to discover what source products and types exist.",{"type":44,"tag":53,"props":2271,"children":2273},{"id":2272},"example-5-full-text-search-for-signals",[2274],{"type":50,"value":2275},"Example 5: Full-Text Search for Signals",{"type":44,"tag":60,"props":2277,"children":2278},{},[2279,2281,2287],{"type":50,"value":2280},"When you know a specific keyword or phrase to search for (e.g. a product name, error message, or URL), full-text search with ",{"type":44,"tag":84,"props":2282,"children":2284},{"className":2283},[],[2285],{"type":50,"value":2286},"ILIKE",{"type":50,"value":2288}," is faster and more precise than semantic search:",{"type":44,"tag":493,"props":2290,"children":2292},{"className":495,"code":2291,"language":22,"meta":497,"style":497},"SELECT\n    document_id,\n    content,\n    source_product,\n    source_type,\n    signal_ts\nFROM (\n    SELECT\n        document_id,\n        argMax(content, inserted_at) as content,\n        argMax(metadata.source_product, inserted_at) as source_product,\n        argMax(metadata.source_type, inserted_at) as source_type,\n        argMax(metadata.deleted, inserted_at) as deleted,\n        argMax(timestamp, inserted_at) as signal_ts\n    FROM document_embeddings\n    WHERE model_name = 'text-embedding-3-small-1536'\n      AND product = 'signals'\n      AND document_type = 'signal'\n      AND timestamp >= now() - INTERVAL 1 MONTH\n    GROUP BY document_id\n)\nWHERE deleted != 'true'\n  AND content ILIKE '%feature flag%'\nORDER BY signal_ts DESC\nLIMIT 10\n",[2293],{"type":44,"tag":84,"props":2294,"children":2295},{"__ignoreMap":497},[2296,2303,2310,2317,2324,2331,2338,2345,2352,2359,2366,2373,2380,2387,2394,2401,2408,2415,2422,2429,2436,2443,2450,2458,2465],{"type":44,"tag":503,"props":2297,"children":2298},{"class":505,"line":506},[2299],{"type":44,"tag":503,"props":2300,"children":2301},{},[2302],{"type":50,"value":1387},{"type":44,"tag":503,"props":2304,"children":2305},{"class":505,"line":515},[2306],{"type":44,"tag":503,"props":2307,"children":2308},{},[2309],{"type":50,"value":1395},{"type":44,"tag":503,"props":2311,"children":2312},{"class":505,"line":524},[2313],{"type":44,"tag":503,"props":2314,"children":2315},{},[2316],{"type":50,"value":1403},{"type":44,"tag":503,"props":2318,"children":2319},{"class":505,"line":533},[2320],{"type":44,"tag":503,"props":2321,"children":2322},{},[2323],{"type":50,"value":1419},{"type":44,"tag":503,"props":2325,"children":2326},{"class":505,"line":794},[2327],{"type":44,"tag":503,"props":2328,"children":2329},{},[2330],{"type":50,"value":1427},{"type":44,"tag":503,"props":2332,"children":2333},{"class":505,"line":803},[2334],{"type":44,"tag":503,"props":2335,"children":2336},{},[2337],{"type":50,"value":1688},{"type":44,"tag":503,"props":2339,"children":2340},{"class":505,"line":812},[2341],{"type":44,"tag":503,"props":2342,"children":2343},{},[2344],{"type":50,"value":1443},{"type":44,"tag":503,"props":2346,"children":2347},{"class":505,"line":821},[2348],{"type":44,"tag":503,"props":2349,"children":2350},{},[2351],{"type":50,"value":775},{"type":44,"tag":503,"props":2353,"children":2354},{"class":505,"line":830},[2355],{"type":44,"tag":503,"props":2356,"children":2357},{},[2358],{"type":50,"value":783},{"type":44,"tag":503,"props":2360,"children":2361},{"class":505,"line":839},[2362],{"type":44,"tag":503,"props":2363,"children":2364},{},[2365],{"type":50,"value":791},{"type":44,"tag":503,"props":2367,"children":2368},{"class":505,"line":27},[2369],{"type":44,"tag":503,"props":2370,"children":2371},{},[2372],{"type":50,"value":809},{"type":44,"tag":503,"props":2374,"children":2375},{"class":505,"line":856},[2376],{"type":44,"tag":503,"props":2377,"children":2378},{},[2379],{"type":50,"value":818},{"type":44,"tag":503,"props":2381,"children":2382},{"class":505,"line":865},[2383],{"type":44,"tag":503,"props":2384,"children":2385},{},[2386],{"type":50,"value":827},{"type":44,"tag":503,"props":2388,"children":2389},{"class":505,"line":874},[2390],{"type":44,"tag":503,"props":2391,"children":2392},{},[2393],{"type":50,"value":845},{"type":44,"tag":503,"props":2395,"children":2396},{"class":505,"line":883},[2397],{"type":44,"tag":503,"props":2398,"children":2399},{},[2400],{"type":50,"value":853},{"type":44,"tag":503,"props":2402,"children":2403},{"class":505,"line":892},[2404],{"type":44,"tag":503,"props":2405,"children":2406},{},[2407],{"type":50,"value":862},{"type":44,"tag":503,"props":2409,"children":2410},{"class":505,"line":901},[2411],{"type":44,"tag":503,"props":2412,"children":2413},{},[2414],{"type":50,"value":871},{"type":44,"tag":503,"props":2416,"children":2417},{"class":505,"line":910},[2418],{"type":44,"tag":503,"props":2419,"children":2420},{},[2421],{"type":50,"value":880},{"type":44,"tag":503,"props":2423,"children":2424},{"class":505,"line":1516},[2425],{"type":44,"tag":503,"props":2426,"children":2427},{},[2428],{"type":50,"value":889},{"type":44,"tag":503,"props":2430,"children":2431},{"class":505,"line":1524},[2432],{"type":44,"tag":503,"props":2433,"children":2434},{},[2435],{"type":50,"value":898},{"type":44,"tag":503,"props":2437,"children":2438},{"class":505,"line":1532},[2439],{"type":44,"tag":503,"props":2440,"children":2441},{},[2442],{"type":50,"value":907},{"type":44,"tag":503,"props":2444,"children":2445},{"class":505,"line":1540},[2446],{"type":44,"tag":503,"props":2447,"children":2448},{},[2449],{"type":50,"value":916},{"type":44,"tag":503,"props":2451,"children":2452},{"class":505,"line":1548},[2453],{"type":44,"tag":503,"props":2454,"children":2455},{},[2456],{"type":50,"value":2457},"  AND content ILIKE '%feature flag%'\n",{"type":44,"tag":503,"props":2459,"children":2460},{"class":505,"line":1556},[2461],{"type":44,"tag":503,"props":2462,"children":2463},{},[2464],{"type":50,"value":2227},{"type":44,"tag":503,"props":2466,"children":2467},{"class":505,"line":1564},[2468],{"type":44,"tag":503,"props":2469,"children":2470},{},[2471],{"type":50,"value":1587},{"type":44,"tag":60,"props":2473,"children":2474},{},[2475,2476,2482,2484,2489,2491,2497],{"type":50,"value":2239},{"type":44,"tag":84,"props":2477,"children":2479},{"className":2478},[],[2480],{"type":50,"value":2481},"'%feature flag%'",{"type":50,"value":2483}," with whatever term you're looking for. Use ",{"type":44,"tag":84,"props":2485,"children":2487},{"className":2486},[],[2488],{"type":50,"value":2286},{"type":50,"value":2490}," for case-insensitive substring matching. For exact token matching, use ",{"type":44,"tag":84,"props":2492,"children":2494},{"className":2493},[],[2495],{"type":50,"value":2496},"hasTokenCaseInsensitive(content, 'token')",{"type":50,"value":2498}," instead.",{"type":44,"tag":53,"props":2500,"children":2502},{"id":2501},"gotchas",[2503],{"type":50,"value":2504},"Gotchas",{"type":44,"tag":2506,"props":2507,"children":2508},"ol",{},[2509,2526,2541,2574,2592,2609,2619,2636,2669,2704],{"type":44,"tag":122,"props":2510,"children":2511},{},[2512,2524],{"type":44,"tag":71,"props":2513,"children":2514},{},[2515,2517,2522],{"type":50,"value":2516},"Always use ",{"type":44,"tag":84,"props":2518,"children":2520},{"className":2519},[],[2521],{"type":50,"value":1078},{"type":50,"value":2523}," as the model name.",{"type":50,"value":2525}," This is the only model used for signals.",{"type":44,"tag":122,"props":2527,"children":2528},{},[2529,2539],{"type":44,"tag":71,"props":2530,"children":2531},{},[2532,2537],{"type":44,"tag":84,"props":2533,"children":2535},{"className":2534},[],[2536],{"type":50,"value":939},{"type":50,"value":2538}," arguments must be string literals.",{"type":50,"value":2540}," You cannot pass column references or expressions — the function resolves at compile time, not per row.",{"type":44,"tag":122,"props":2542,"children":2543},{},[2544,2549,2551,2557,2559,2565,2567,2572],{"type":44,"tag":71,"props":2545,"children":2546},{},[2547],{"type":50,"value":2548},"Always time-bound your queries.",{"type":50,"value":2550}," The table has a 3-month TTL, but unbounded scans are expensive. Use ",{"type":44,"tag":84,"props":2552,"children":2554},{"className":2553},[],[2555],{"type":50,"value":2556},"timestamp >= now() - INTERVAL 1 MONTH",{"type":50,"value":2558}," or tighter. Place the time filter in the inner subquery's ",{"type":44,"tag":84,"props":2560,"children":2562},{"className":2561},[],[2563],{"type":50,"value":2564},"WHERE",{"type":50,"value":2566}," clause (on the raw ",{"type":44,"tag":84,"props":2568,"children":2570},{"className":2569},[],[2571],{"type":50,"value":385},{"type":50,"value":2573}," column) for best performance.",{"type":44,"tag":122,"props":2575,"children":2576},{},[2577,2582,2584,2590],{"type":44,"tag":71,"props":2578,"children":2579},{},[2580],{"type":50,"value":2581},"Always deduplicate.",{"type":50,"value":2583}," Without the ",{"type":44,"tag":84,"props":2585,"children":2587},{"className":2586},[],[2588],{"type":50,"value":2589},"argMax(..., inserted_at) GROUP BY document_id",{"type":50,"value":2591}," subquery, you will see stale and duplicate rows.",{"type":44,"tag":122,"props":2593,"children":2594},{},[2595,2607],{"type":44,"tag":71,"props":2596,"children":2597},{},[2598,2600,2605],{"type":50,"value":2599},"Only select ",{"type":44,"tag":84,"props":2601,"children":2603},{"className":2602},[],[2604],{"type":50,"value":470},{"type":50,"value":2606}," when you need it.",{"type":50,"value":2608}," It's a 1536-element float array — omit it from the inner subquery when you're not doing similarity search.",{"type":44,"tag":122,"props":2610,"children":2611},{},[2612,2617],{"type":44,"tag":71,"props":2613,"children":2614},{},[2615],{"type":50,"value":2616},"Queries should not end with a semicolon.",{"type":50,"value":2618}," HogQL does not use them.",{"type":44,"tag":122,"props":2620,"children":2621},{},[2622,2634],{"type":44,"tag":71,"props":2623,"children":2624},{},[2625,2627,2632],{"type":50,"value":2626},"Add a ",{"type":44,"tag":84,"props":2628,"children":2630},{"className":2629},[],[2631],{"type":50,"value":1052},{"type":50,"value":2633}," to every query.",{"type":50,"value":2635}," Maximum allowed is 500 rows. In general, you should only select 10 or so signals, using semantic or full text search to rank them.",{"type":44,"tag":122,"props":2637,"children":2638},{},[2639,2644,2646,2652,2654,2659,2661,2667],{"type":44,"tag":71,"props":2640,"children":2641},{},[2642],{"type":50,"value":2643},"Extract metadata fields inside the dedup subquery.",{"type":50,"value":2645}," HogQL's ",{"type":44,"tag":84,"props":2647,"children":2649},{"className":2648},[],[2650],{"type":50,"value":2651},"metadata.field",{"type":50,"value":2653}," dot access only works on the raw table column. After ",{"type":44,"tag":84,"props":2655,"children":2657},{"className":2656},[],[2658],{"type":50,"value":676},{"type":50,"value":2660}," aggregation, the JSON type is lost and dot access will fail with a type error. Always use ",{"type":44,"tag":84,"props":2662,"children":2664},{"className":2663},[],[2665],{"type":50,"value":2666},"argMax(metadata.field_name, inserted_at) as field_name",{"type":50,"value":2668}," in the inner query.",{"type":44,"tag":122,"props":2670,"children":2671},{},[2672,2683,2685,2690,2692,2697,2698,2703],{"type":44,"tag":71,"props":2673,"children":2674},{},[2675,2677,2682],{"type":50,"value":2676},"All JSON dot-access values are ",{"type":44,"tag":84,"props":2678,"children":2680},{"className":2679},[],[2681],{"type":50,"value":704},{"type":50,"value":645},{"type":50,"value":2684}," HogQL extracts every JSON field as a String, even booleans and numbers. For ",{"type":44,"tag":84,"props":2686,"children":2688},{"className":2687},[],[2689],{"type":50,"value":712},{"type":50,"value":2691},", use ",{"type":44,"tag":84,"props":2693,"children":2695},{"className":2694},[],[2696],{"type":50,"value":743},{"type":50,"value":745},{"type":44,"tag":84,"props":2699,"children":2701},{"className":2700},[],[2702],{"type":50,"value":751},{"type":50,"value":645},{"type":44,"tag":122,"props":2705,"children":2706},{},[2707,2734,2736,2742],{"type":44,"tag":71,"props":2708,"children":2709},{},[2710,2712,2718,2720,2725,2727,2732],{"type":50,"value":2711},"Don't alias ",{"type":44,"tag":84,"props":2713,"children":2715},{"className":2714},[],[2716],{"type":50,"value":2717},"argMax(timestamp, inserted_at)",{"type":50,"value":2719}," as ",{"type":44,"tag":84,"props":2721,"children":2723},{"className":2722},[],[2724],{"type":50,"value":385},{"type":50,"value":2726}," if the same inner query also filters on the raw ",{"type":44,"tag":84,"props":2728,"children":2730},{"className":2729},[],[2731],{"type":50,"value":385},{"type":50,"value":2733}," column.",{"type":50,"value":2735}," HogQL resolves the alias name first, causing an \"aggregate in WHERE\" error. Either use a distinct alias like ",{"type":44,"tag":84,"props":2737,"children":2739},{"className":2738},[],[2740],{"type":50,"value":2741},"signal_ts",{"type":50,"value":2743},", or move the time filter to the outer query.",{"type":44,"tag":2745,"props":2746,"children":2747},"style",{},[2748],{"type":50,"value":2749},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2751,"total":2869},[2752,2767,2785,2802,2819,2833,2851],{"slug":2753,"name":2753,"fn":2754,"description":2755,"org":2756,"tags":2757,"stars":23,"repoUrl":24,"updatedAt":2766},"analyzing-experiment-session-replays","analyze session replays for PostHog experiments","Analyze session replay patterns across experiment variants to understand user behavior differences. Use when the user wants to see how users interact with different experiment variants, identify usability issues, compare behavior patterns between control and test groups, or get qualitative insights to complement quantitative experiment results.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2758,2759,2762,2763],{"name":18,"slug":19,"type":13},{"name":2760,"slug":2761,"type":13},"Design","design",{"name":9,"slug":8,"type":13},{"name":2764,"slug":2765,"type":13},"User Research","user-research","2026-04-06T18:44:38.291781",{"slug":2768,"name":2768,"fn":2769,"description":2770,"org":2771,"tags":2772,"stars":23,"repoUrl":24,"updatedAt":2784},"assessing-heatmaps","analyze page heatmaps and suggest improvements","Assesses what a page's heatmap is telling you and recommends concrete changes. Pulls click \u002F rageclick \u002F scroll-depth data for a URL, names the hot elements by cross-referencing autocapture events on the same page, and can create a saved heatmap the user opens in PostHog, then summarizes the behavior and proposes improvements.\nTRIGGER when: user asks what a heatmap shows, why people aren't clicking something, where users rage-click, how far they scroll, what to change on a page based on heatmap\u002Fclick data, or to 'analyze\u002Fassess\u002Freview the heatmap' for a URL.\nDO NOT TRIGGER when: the user only wants to create a saved heatmap screenshot with no analysis (use heatmaps-saved-create directly), or is asking about session replay in general (use investigating-replay).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2773,2774,2777,2778,2781],{"name":18,"slug":19,"type":13},{"name":2775,"slug":2776,"type":13},"Frontend","frontend",{"name":9,"slug":8,"type":13},{"name":2779,"slug":2780,"type":13},"Product Management","product-management",{"name":2782,"slug":2783,"type":13},"UX Design","ux-design","2026-06-05T07:40:43.37798",{"slug":2786,"name":2786,"fn":2787,"description":2788,"org":2789,"tags":2790,"stars":23,"repoUrl":24,"updatedAt":2801},"auditing-experiments-flags","audit PostHog experiments and feature flags","Audit PostHog experiments and feature flags for configuration issues, staleness, and best-practice violations. Read when the user asks to audit, health-check, or review experiments or feature flags, check flag hygiene, or verify experiment setup.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2791,2794,2797,2798],{"name":2792,"slug":2793,"type":13},"Audit","audit",{"name":2795,"slug":2796,"type":13},"Feature Flags","feature-flags",{"name":9,"slug":8,"type":13},{"name":2799,"slug":2800,"type":13},"QA","qa","2026-04-06T18:44:30.657553",{"slug":2803,"name":2803,"fn":2804,"description":2805,"org":2806,"tags":2807,"stars":23,"repoUrl":24,"updatedAt":2818},"authoring-scouts","author and edit PostHog Signals scouts","How to author, edit, and adapt PostHog Signals scouts — the scheduled agents that scan a project and write reports into the Signals inbox. Use when a user wants to customize a canonical scout for their own setup (narrow its scope, retune its thresholds, add disqualifiers), tweak a scout's schedule or dry-run posture, or write a brand-new scout from scratch for a specific use case (a custom event, a product surface no canonical scout covers), or steer a scout without editing it at all by leaving it a note. Covers the scout SKILL.md anatomy, the report contract, the dedupe + scratchpad-memory conventions, the scout-notes steering channel, the per-team skills-store path vs the canonical in-repo path, and the write-and-inspect test loop (with dry-run as an optional safety net). Trigger on \"write\u002Fedit\u002Fcustomize a signals scout\", \"new scout for X\", \"tune my scout schedule\", \"make a scout that watches \u003Cevent>\", \"leave a note for \u002F give feedback to a scout\", \"tell the scouts about X\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2808,2811,2814,2817],{"name":2809,"slug":2810,"type":13},"Agents","agents",{"name":2812,"slug":2813,"type":13},"Automation","automation",{"name":2815,"slug":2816,"type":13},"Observability","observability",{"name":9,"slug":8,"type":13},"2026-07-28T05:33:45.509154",{"slug":2820,"name":2820,"fn":2821,"description":2822,"org":2823,"tags":2824,"stars":23,"repoUrl":24,"updatedAt":2832},"building-a-dashboard","build and update PostHog dashboards","Build a new dashboard, or update an existing one, from a set of insights — the same job the in-app assistant does with its upsert-dashboard tool, but over MCP. Use when a user asks to create a dashboard, put several metrics\u002Fcharts together on one page, assemble a dashboard for a topic (product analytics, retention, revenue, activation, etc.), or add\u002Fremove\u002Freplace insights on a dashboard they already have. Covers deciding create vs update, reusing existing insights vs creating new ones, and using PostHog's vetted dashboard templates as reference for what a strong dashboard on a topic looks like.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2825,2826,2829],{"name":18,"slug":19,"type":13},{"name":2827,"slug":2828,"type":13},"Dashboards","dashboards",{"name":2830,"slug":2831,"type":13},"MCP","mcp","2026-07-21T06:07:38.060598",{"slug":2834,"name":2834,"fn":2835,"description":2836,"org":2837,"tags":2838,"stars":23,"repoUrl":24,"updatedAt":2850},"checking-deploy-timing","correlate PostHog deployments with GitHub commits","Determine when a PostHog code change reached a given environment by reading the hidden GIT deploy annotations in the project and correlating them with the merge commit on GitHub. Use when PostHog staff ask \"when was X deployed\", \"is my change live in the US\u002FEU yet\", \"has my PR shipped\", \"did the fix roll out to prod-us\", or otherwise want to know whether\u002Fwhen a commit, PR, or feature went out to a region. Do not answer deploy-timing questions from event\u002Fdata volume alone — that only shows when data changed, not when code shipped.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2839,2842,2845,2848,2849],{"name":2840,"slug":2841,"type":13},"Deployment","deployment",{"name":2843,"slug":2844,"type":13},"Git","git",{"name":2846,"slug":2847,"type":13},"GitHub","github",{"name":2815,"slug":2816,"type":13},{"name":9,"slug":8,"type":13},"2026-06-28T07:46:59.53536",{"slug":2852,"name":2852,"fn":2853,"description":2854,"org":2855,"tags":2856,"stars":23,"repoUrl":24,"updatedAt":2868},"choosing-trend-or-slope-view","visualize trends and growth over time","Clarify how to visualize change over a time range before building a trend. Use whenever the user asks how much something changed, grew, dropped, improved, or regressed between two points or periods — \"how much did X change from A to B\", \"before vs after\", \"start vs end\", \"week over week\", \"compare this month to last\", \"change over time\" — or mentions a \"slope chart\" \u002F \"slopegraph\". Two readings of \"change\" need different charts: the whole trend (a line, every interval) versus just the two endpoints (a slope, start vs end). Ask which they want, then render it. Not for choosing a saved insight ChartDisplayType in the insight editor.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2857,2858,2861,2864,2865],{"name":18,"slug":19,"type":13},{"name":2859,"slug":2860,"type":13},"Charts","charts",{"name":2862,"slug":2863,"type":13},"Data Visualization","data-visualization",{"name":9,"slug":8,"type":13},{"name":2866,"slug":2867,"type":13},"Reporting","reporting","2026-06-18T08:18:57.960157",56,{"items":2871,"total":3030},[2872,2887,2897,2910,2923,2938,2954,2967,2979,2994,3004,3020],{"slug":2873,"name":2873,"fn":2874,"description":2875,"org":2876,"tags":2877,"stars":2884,"repoUrl":2885,"updatedAt":2886},"analyzing-expensive-users","analyze expensive users in AI observability","Analyze the most expensive users in AI observability and explain why they cost so much. Use when the user asks about top spenders, expensive users, per-user LLM cost, user-level cost drivers, or patterns behind high AI observability spend.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2878,2879,2882,2883],{"name":18,"slug":19,"type":13},{"name":2880,"slug":2881,"type":13},"Cost Optimization","cost-optimization",{"name":2815,"slug":2816,"type":13},{"name":9,"slug":8,"type":13},35568,"https:\u002F\u002Fgithub.com\u002FPostHog\u002Fposthog","2026-07-28T05:34:11.117757",{"slug":2888,"name":2888,"fn":2889,"description":2890,"org":2891,"tags":2892,"stars":2884,"repoUrl":2885,"updatedAt":2896},"auditing-endpoints","audit PostHog project endpoints","Audit every endpoint in a PostHog project for staleness, failed materialisations, and unused materialised versions. Use when the user asks \"what endpoints can I clean up?\", \"are any of my endpoints broken?\", \"which materialised versions are still being called?\", or wants a one-shot cleanup pass over the Endpoints product. Produces a prioritised report grouped by issue type, with recommended actions but does not modify anything without explicit confirmation.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2893,2894,2895],{"name":18,"slug":19,"type":13},{"name":2792,"slug":2793,"type":13},{"name":9,"slug":8,"type":13},"2026-06-08T08:08:33.693989",{"slug":2898,"name":2898,"fn":2899,"description":2900,"org":2901,"tags":2902,"stars":2884,"repoUrl":2885,"updatedAt":2909},"auditing-warehouse-source-health","audit PostHog data warehouse source health","Audit the health of a PostHog project's data warehouse sources and syncs — find every broken or degraded source connection, sync schema, and webhook channel. Use when the user asks \"why are my imports failing?\", \"what's broken with my sources?\", \"why is my warehouse data stale?\", or wants a one-shot triage of source\u002Fsync health before deciding where to dig in. Produces a prioritized report grouped by severity, with recommended next steps. For materialized-view health use `auditing-warehouse-view-health`; for a single failing sync use `diagnosing-failed-warehouse-syncs`.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2903,2904,2907,2908],{"name":2792,"slug":2793,"type":13},{"name":2905,"slug":2906,"type":13},"Data Warehouse","data-warehouse",{"name":2815,"slug":2816,"type":13},{"name":9,"slug":8,"type":13},"2026-06-18T08:22:57.67984",{"slug":2911,"name":2911,"fn":2912,"description":2913,"org":2914,"tags":2915,"stars":2884,"repoUrl":2885,"updatedAt":2922},"auditing-warehouse-view-health","audit PostHog materialized view health","Audit the health of a PostHog project's materialized views (saved queries) — find every failed materialization and flag unused or stale materialized views that cost storage and compute. Use when the user asks \"which of my views are broken?\", \"why is this materialized view failing?\", \"are any of my views wasting compute?\", or wants a one-shot triage of view health. For source\u002Fsync health use `auditing-warehouse-source-health`.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2916,2917,2918,2921],{"name":2792,"slug":2793,"type":13},{"name":2905,"slug":2906,"type":13},{"name":2919,"slug":2920,"type":13},"Performance","performance",{"name":9,"slug":8,"type":13},"2026-06-18T08:25:10.936787",{"slug":2924,"name":2924,"fn":2925,"description":2926,"org":2927,"tags":2928,"stars":2884,"repoUrl":2885,"updatedAt":2937},"authoring-error-tracking-alerts","author PostHog error tracking alerts","Author error tracking alerts that fire when an issue is created, reopened, or starts spiking. Use when the user asks to set up error notifications, route exceptions to Slack\u002Fwebhook\u002FLinear, or evaluate which error events are worth alerting on. Covers trigger-event selection, integration choice, dedup against existing alerts, and shipping with the canonical message body shape.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2929,2932,2935,2936],{"name":2930,"slug":2931,"type":13},"Alerting","alerting",{"name":2933,"slug":2934,"type":13},"Debugging","debugging",{"name":2815,"slug":2816,"type":13},{"name":9,"slug":8,"type":13},"2026-06-18T08:24:40.318583",{"slug":2939,"name":2939,"fn":2940,"description":2941,"org":2942,"tags":2943,"stars":2884,"repoUrl":2885,"updatedAt":2953},"authoring-log-alerts","author log alerts in PostHog","Author useful, low-noise log alerts on services in a PostHog project. Use when the user asks to set up alerts for their logs, suggest alerts they should add, or evaluate whether a service is worth monitoring. Covers service triage, baseline characterisation, threshold drafting, back-testing via simulate, and shipping with a notification destination.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2944,2945,2948,2949,2952],{"name":18,"slug":19,"type":13},{"name":2946,"slug":2947,"type":13},"Monitoring","monitoring",{"name":2815,"slug":2816,"type":13},{"name":2950,"slug":2951,"type":13},"Operations","operations",{"name":9,"slug":8,"type":13},"2026-07-18T05:10:54.430898",{"slug":2955,"name":2955,"fn":2956,"description":2957,"org":2958,"tags":2959,"stars":2884,"repoUrl":2885,"updatedAt":2966},"building-workflows","build and edit PostHog workflows","Build, edit, test, enable, and monitor PostHog workflows over MCP. Author the action\u002Fedge graph so it runs and opens cleanly in the visual editor, then change drafts surgically with patch operations. Use when asked to build, set up, automate, change, fix, or debug a workflow, campaign, broadcast, drip sequence, or event-triggered automation in the workflows product.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2960,2961,2962,2963],{"name":2812,"slug":2813,"type":13},{"name":2830,"slug":2831,"type":13},{"name":9,"slug":8,"type":13},{"name":2964,"slug":2965,"type":13},"Workflow Automation","workflow-automation","2026-07-28T05:34:12.167015",{"slug":2968,"name":2968,"fn":2969,"description":2970,"org":2971,"tags":2972,"stars":2884,"repoUrl":2885,"updatedAt":2978},"check-posthog-loading","inspect PostHog SDK loading across URLs","Inspect how the PostHog JavaScript SDK is loaded across a list of URLs. Use to confirm consistent installation across pages, find pages missing the snippet, detect mismatched API keys or hosts between pages, and verify the load method (head snippet vs deferred vs array.js).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2973,2974,2975,2976,2977],{"name":18,"slug":19,"type":13},{"name":2933,"slug":2934,"type":13},{"name":2775,"slug":2776,"type":13},{"name":2815,"slug":2816,"type":13},{"name":9,"slug":8,"type":13},"2026-05-07T05:56:19.828048",{"slug":2980,"name":2980,"fn":2981,"description":2982,"org":2983,"tags":2984,"stars":2884,"repoUrl":2885,"updatedAt":2993},"consuming-endpoints-from-client-code","integrate PostHog endpoints into client applications","Wire a PostHog endpoint into a client app or SDK. Covers fetching the OpenAPI spec, generating a typed client with openapi-generator or @hey-api\u002Fopenapi-ts, sending the right auth header, shaping the variables payload (HogQL code_name vs insight breakdown property), handling rate-limit and materialised-endpoint error responses. Use when the user says \"how do I call my endpoint\", \"generate a client for this\", or \"what auth header do I use\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2985,2988,2989,2990],{"name":2986,"slug":2987,"type":13},"API Development","api-development",{"name":2775,"slug":2776,"type":13},{"name":9,"slug":8,"type":13},{"name":2991,"slug":2992,"type":13},"SDK","sdk","2026-06-08T08:08:34.929454",{"slug":2995,"name":2995,"fn":2996,"description":2997,"org":2998,"tags":2999,"stars":2884,"repoUrl":2885,"updatedAt":3003},"copying-endpoints-across-projects","copy PostHog endpoints across projects","Copy a PostHog endpoint (a saved HogQL\u002Finsight query exposed as an API route) to another project in the same organization, or duplicate it under a new name in the same project. Use when the user wants to duplicate an endpoint, promote an endpoint from staging to production, replicate an endpoint's query\u002Fvariables\u002Ffreshness config in another workspace, or clone an endpoint to iterate on it. Unlike feature flags and experiments, endpoints have NO native cross-project copy tool — this skill covers the read-then-recreate flow (endpoint-get then endpoint-create), the active-project switching it requires, name-collision checks, and the safe defaults (land unmaterialised in the target, verify with endpoint-run). Does not cover editing endpoint versions (see managing-endpoint-versions) or authoring a brand-new endpoint from scratch (see creating-an-endpoint).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3000,3001,3002],{"name":2986,"slug":2987,"type":13},{"name":2950,"slug":2951,"type":13},{"name":9,"slug":8,"type":13},"2026-07-15T05:29:58.442727",{"slug":3005,"name":3005,"fn":3006,"description":3007,"org":3008,"tags":3009,"stars":2884,"repoUrl":2885,"updatedAt":3019},"creating-ai-subscription","schedule recurring AI-generated PostHog reports","Create a recurring AI-generated PostHog report — schedule a free-text prompt to run on a cron, with the LLM-synthesized markdown delivered to email or Slack on each tick. Use when the user wants a recurring AI summary of X on any cadence (daily, weekly, monthly, yearly) rather than a one-off report. (To attach an AI summary to an existing insight\u002Fdashboard subscription instead of a free-text prompt, see `managing-subscriptions` and its `summary_enabled` option.)\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3010,3011,3014,3015,3016],{"name":2812,"slug":2813,"type":13},{"name":3012,"slug":3013,"type":13},"Email","email",{"name":9,"slug":8,"type":13},{"name":2866,"slug":2867,"type":13},{"name":3017,"slug":3018,"type":13},"Slack","slack","2026-06-09T07:32:27.935712",{"slug":3021,"name":3021,"fn":3022,"description":3023,"org":3024,"tags":3025,"stars":2884,"repoUrl":2885,"updatedAt":3029},"creating-an-endpoint","create PostHog API endpoints","Create a PostHog endpoint with the right shape on the first try — covers query kind choice, name conventions, what to expose as variables (HogQL code_name vs insight breakdown), data_freshness_seconds, and whether to materialise on day one. Use when the user says \"create an endpoint\", \"expose this query as an API\", \"turn this insight into an endpoint\", or asks for help structuring a new endpoint. Steers away from common mistakes: materialising a query with cohort breakdowns or compare mode, inline-only variables on a materialised endpoint, unbounded date ranges, ambiguous names.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3026,3027,3028],{"name":18,"slug":19,"type":13},{"name":2986,"slug":2987,"type":13},{"name":9,"slug":8,"type":13},"2026-06-08T08:08:29.624498",231]