Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(skills): make the picker skill an evidence-led index (#117649)

Paul D'Ambra221ae3012547
diff --git a/.agents/skills/modifying-taxonomic-filter/SKILL.md b/.agents/skills/modifying-taxonomic-filter/SKILL.md
index cf64c5ac1c19..c67d350a18b0 100644
--- a/.agents/skills/modifying-taxonomic-filter/SKILL.md
+++ b/.agents/skills/modifying-taxonomic-filter/SKILL.md
@@ -1,207 +1,96 @@
---
name: modifying-taxonomic-filter
-description: Guides safe changes to the TaxonomicFilter, PostHog's picker for events, actions, properties, cohorts, and more. Use when adding features, fixing bugs, improving search or loading performance, or refactoring the classic picker, rebuild menu, or headless filter panel. Covers real selection behavior, two live surfaces, shared telemetry, the conditional Postgres search plan, and result reveal rules.
+description: Guides safe, evidence-led changes to the TaxonomicFilter, PostHog's picker for events, actions, properties, cohorts, and more. Use when adding features, fixing bugs, removing groups or tabs, changing search, ordering, recents, pinning, empty states, loading or performance, or refactoring the classic picker, rebuild menu, or headless filter panel. Indexes how users actually pick, known failure modes, the feature inventory, design principles, contested decisions, where to find evidence, and how to measure a change.
---
# Modifying the TaxonomicFilter
-The TaxonomicFilter is the picker users hit to choose any "thing PostHog
-knows about" — events, properties, actions, cohorts, groups. It's the
-on-ramp into almost every analytics and replay configuration. Code lives
-in `frontend/src/lib/components/TaxonomicFilter/`.
-
-**Three guardrails:**
-
-1. Changes that demote items users _actually pick_ are regressions, even
- with all tests passing. Read "Product reality" before deciding any
- change is safe. Ordering, promotion, or position-0 changes need
- explicit human sign-off — don't let an agent decide alone.
-2. There are **two live surfaces**, and the
- rebuild is a parallel reimplementation of the legacy data + group
- layer — not a skin over it. A behaviour change usually has to land in
- **both** the legacy code and the rebuild, or the two arms of the
- experiment diverge. Read "Two surfaces" and "Mirroring changes"
- before assuming one edit is enough.
-3. Search is the main selection path. The definition endpoints select a
- Postgres plan from the project size. The picker also shows results before
- optional counts finish. Read
- [references/performance.md](references/performance.md) before you change
- search, loading, pagination, or result reveal behavior.
-
-## Product reality (last refreshed 2026-05-02, 90-day window)
-
-Ratios from production telemetry. Re-run via
-[references/refreshing-product-reality.md](references/refreshing-product-reality.md)
-when older than ~3 months.
-
-### How users pick
-
-- **Top three rows carry ~80% of selections** (position 0: ~56%,
- position 1: ~15%, position 2: ~8%). Demoting a popular item out of
- the top three is a real-user regression.
-- **~34% selection rate.** Two of every three opens close without a
- pick. p50 dwell ~7s, p90 ~53s — most opens are quick glances.
-- **Selection paths**: ~65% via search, ~19% browsed-no-search,
- ~16% from recents, <1% from pinned items.
-
-### What users select
-
-| Source group type | Share |
-| ------------------- | ----- |
-| `events` | ~40% |
-| `event_properties` | ~30% |
-| `person_properties` | ~14% |
-| `cohorts` | ~2% |
-| `email_addresses` | ~2% |
-| `actions` | ~2% |
-| `pageview_urls` | ~1% |
-| everything else | <1% |
-
-### What users search for (share of top-8 terms)
-
-| Term | Share |
-| --------- | ----- |
-| `email` | ~29% |
-| `url` | ~22% |
-| `user` | ~12% |
-| `utm` | ~10% |
-| `page` | ~9% |
-| `path` | ~8% |
-| `current` | ~6% |
-| `country` | ~5% |
-
-`email` and `url` are over half the top-8. They're the entire reason
-`PROMOTED_PROPERTIES_BY_SEARCH_TERM` (in `infiniteListLogic.ts`) maps
-them to `$email` and `$current_url` at position 0. **Touching
-promotion or ordering needs explicit human sign-off.**
-
-### Empty searches
-
-`email`, `url`, `utm`, `path` against `cohorts`, `event_feature_flags`,
-`session_properties` produce most empty-result events — users type the
-same canonical terms across every tab. Tab order, suggested-filters
-aggregation, and shortcut routing are how they get to the right answer.
-
-### Input mode
-
-~93% typed, ~7% pasted. Both feed `inputMode` on `taxonomic_filter_search_query`.
-
-## Telemetry is a contract
-
-Treat property shapes as a public API. Every `taxonomic filter *` event now
-carries a `surface` property (`legacy-pill` / `rebuild-menu`) so the
-surfaces are distinguishable by an explicit property. The classic-picker stamp comes from
-`legacyTaxonomicSurface()` in `taxonomicFilterSurface.ts`; the rebuild stamps
-`rebuild-menu` from `menu/TaxonomicFilterMenu.tsx`.
-
-Shared events both surfaces emit (keep these comparable across arms):
-
-- `taxonomic filter closed` — `surface`, `dwellMs`, `hadSelection` (legacy
- also sends `groupType`; the rebuild omits it — there's no single active
- tab at close)
-- `taxonomic filter item selected` — `surface`, `groupType`,
- `sourceGroupType`, `wasFromRecents`, `wasFromPinnedList`, `wasQuickFilter`,
- `hadSearchInput`, `position`, `query`, `wasStale`
-
-Legacy-only: `taxonomic_filter_search_query`
-(`searchQuery`, `groupType`, `inputMode`, `pastedFraction`),
-`taxonomic filter empty result` (`groupType`, `searchQuery`),
-`taxonomic filter include stale toggled`,
-`taxonomic filter category dropdown opened` (pill only).
-
-Rebuild-only menu events: `taxonomic filter menu opened` / `drilled` /
-`closed` / `option clicked` / `item selected`.
-
-When you add a property to a **shared** event, add it to **both** emitters
-or the arms stop being comparable. Adding properties: fine. Removing dead
-ones: fine. **Renaming or repurposing silently is the worst case** —
-dashboards keep working and start lying.
-
-## Two surfaces
-
-One feature flag selects between two surfaces. A bug report that doesn't reproduce
-locally is almost always a variant mismatch — confirm which surface the
-reporter is on first.
-
-| Surface | Flag | Value | What renders |
-| -------------- | ------------------------------- | ----- | --------------------------------------------- |
-| `legacy-pill` | `TAXONOMIC_FILTER_MENU_REBUILD` | off | classic picker with a category dropdown |
-| `rebuild-menu` | `TAXONOMIC_FILTER_MENU_REBUILD` | on | ground-up rewrite in `menu/` over `headless/` |
-
-- **legacy-pill** is the classic picker (`taxonomicFilterLogic.tsx` +
- `InfiniteList`) with a suffix category dropdown. A person can pin the
- category rail from that dropdown.
-- **rebuild-menu** is a separate, opt-in experiment (`@adamleith`) being
- tested internally. It is a **fresh implementation**: the `menu/` dropdown
- and combobox UI on top of `headless/` (a hooks-based filter panel). It
- does **not** route through `taxonomicFilterLogic`/`infiniteListLogic`;
- it has its own group definitions, fetch/pagination, and ordering. See
- `headless/UX_SPEC.md` for its design source of truth.
-
-The rebuild is opt-in in exactly **two consumer wrappers**:
-`TaxonomicPopover.tsx` and
-`PropertyFilters/components/TaxonomicPropertyFilter.tsx`. Both check
-`TAXONOMIC_FILTER_MENU_REBUILD` and render `<TaxonomicFilterMenu>` or the
-legacy `<TaxonomicFilter>`. A call site reaching one of those wrappers can
-still land on the legacy path: `TaxonomicPopover` renders the rebuild only
-when `newMenuSupportsCallSite` holds (`!allowClear && closeOnChange && ref
-== null`), because the rebuilt menu cannot honour those three capabilities.
-So "does this reach the rebuild?" depends on the wrapper _and_ the props
-that call site passes, not a single global switch — `ActionFilterRow` goes
-through `TaxonomicPopover` and passes none of the three, so it does reach
-the rebuild. Only a call site that hand-rolls its own popover around
-`<TaxonomicFilter>` bypasses the wrappers entirely.
-
-**Touching tab/group rendering means testing all three surfaces.**
-
-## Mirroring changes across variants
-
-The rebuild reimplements the legacy data layer rather than reusing it, so
-the same concern lives in two files. There is **no lint rule or test**
-enforcing parity — the only guard is "Mirrors the legacy…" comments. When
-you change one, change the other (or flag to the human that you can't).
-
-| Concern | Legacy | Rebuild |
-| -------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
-| Group definitions (endpoint, excluded props, group meta) | `taxonomicFilterLogic.tsx` `taxonomicGroups` selector | `utils/buildTaxonomicGroups.tsx` |
-| Group ordering + SuggestedFilters injection | `taxonomicFilterLogic.tsx` `taxonomicGroupTypes` selector | `hooks/useTaxonomicFilter.ts` `resolveTaxonomicGroupTypes` |
-| Per-tab fetch / pagination / min-query-length | `infiniteListLogic.ts` | `hooks/useGroupList.ts` + `useTaxonomicResource.ts` + `fetchTaxonomicListPage.ts` |
-| Data-warehouse config flow | inline in `InfiniteList.tsx` | `menu/DwhFlow.tsx` |
-| `taxonomic filter item selected` / `closed` telemetry | `taxonomicFilterLogic.tsx` | `menu/TaxonomicFilterMenu.tsx` |
-| New `TaxonomicFilterGroupType` enum value | `types.ts` (shared) — then add group config in **both** tables above | |
-| Logic-backed group data (Actions, Dashboards, …) | already in kea | also register in `hooks/useTaxonomicLocalOverrides.ts` |
-
-**Genuinely shared — change once:** `types.ts` (the enum),
-`utils/promoteProperties.ts` (`PROMOTED_PROPERTIES_BY_SEARCH_TERM`),
-`recentTaxonomicFiltersLogic.ts` and
-`taxonomicFilterPinnedPropertiesLogic.ts` (the rebuild reads recents/pinned
-through these via a bridge, it doesn't fork them).
-
-`redistributeTopMatches` is legacy-only, not shared: it lives in
-`taxonomicFilterLogic.tsx` and the rebuild never calls it.
-
-One intentional divergence is already documented in
-`useTaxonomicFilter.ts`: both surfaces lead with SuggestedFilters when the
-picker has more than one substantive group. Preserve documented divergences;
-don't "fix" them into parity.
+The TaxonomicFilter is the picker users hit to choose any "thing PostHog knows about": events, properties, actions, cohorts, groups.
+It is the on-ramp into almost every analytics, flags and replay configuration.
+Code lives in `frontend/src/lib/components/TaxonomicFilter/`.
+
+This file is an index.
+Read it fully, then load only the references your change needs.
+The references hold the detail and the evidence.
+
+## Four guardrails
+
+1. **Decide with evidence, not taste.**
+ Everyone who has worked on this picker has strong opinions, and some of them are wrong.
+ Check a claim against [product-reality](references/product-reality.md) and [evidence-sources](references/evidence-sources.md) before acting on it, including claims in issues, Slack, or this skill.
+2. **Demoting what users actually pick is a regression**, even with every test green.
+ Ordering, promotion, position-0 and default-tab changes need explicit human sign-off.
+3. **Two surfaces, two implementations.**
+ The rebuild reimplements the legacy data layer.
+ Most behavior changes land in both, or the arms diverge.
+ See [surfaces-and-mirroring](references/surfaces-and-mirroring.md).
+4. **Telemetry is a public contract.**
+ Dashboards and replay scanners read these events.
+ Never rename or repurpose a property silently.
+ `telemetryContract.test.ts` fails when a capture call and the contract disagree, so update the contract in the same PR.
+ See [telemetry-contract](references/telemetry-contract.md).
+
+## The picture in five lines (refreshed 2026-10-15)
+
+- Most engaged legacy opens end in a selection (~85%), and most never touch a category tab (~96%).
+- The Suggested view carries about 70% of legacy selections.
+ Just over half of those come from recents.
+- Position matters: ~52% of legacy picks are row 0, ~85% are in the top three.
+- The biggest failure is a category picked first, then a search that finds nothing.
+ Most empty searches are the right word in the wrong tab.
+- Customers report broken UI and missing items far more than slowness.
+
+Detail, windows and caveats: [product-reality](references/product-reality.md).
+These numbers are a snapshot.
+For current values, run the `taxonomic_filter_*` metrics in the PostHog data catalog (see [refreshing-product-reality](references/refreshing-product-reality.md#live-metrics)).
+
+## Route by what you are changing
+
+| You are changing | Read first |
+| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Ordering, promotion, Suggested, default tab | [product-reality](references/product-reality.md), [design-principles](references/design-principles.md), [contested-decisions](references/contested-decisions.md) |
+| Adding, removing or hiding a group or tab | [feature-inventory](references/feature-inventory.md), [surfaces-and-mirroring](references/surfaces-and-mirroring.md), [call-sites](references/call-sites-and-blast-radius.md) |
+| Search, empty states, no-results recovery | [failure-modes](references/failure-modes.md), [design-principles](references/design-principles.md) |
+| Recents, pinning, remembered state | [contested-decisions](references/contested-decisions.md), [design-principles](references/design-principles.md) |
+| Loading, latency, pagination, errors | [performance](references/performance.md), [failure-modes](references/failure-modes.md) |
+| Telemetry or dashboards | [telemetry-contract](references/telemetry-contract.md), [measuring-changes](references/measuring-changes.md) |
+| Any refactor | [architecture](references/architecture.md), [common-pitfalls](references/common-pitfalls.md), [testing-patterns](references/testing-patterns.md) |
+| A bug report you can't reproduce | [surfaces-and-mirroring](references/surfaces-and-mirroring.md) (confirm the surface first) |
+| Deciding whether a change is worth it | [evidence-sources](references/evidence-sources.md), [measuring-changes](references/measuring-changes.md) |
+
+## Working loop
+
+1. **State the user problem.**
+ Which surface, which users, what goes wrong.
+ Find it in the evidence, not only in the request.
+ See [evidence-sources](references/evidence-sources.md).
+2. **Size it.**
+ Use ratios from telemetry.
+ A change that helps 0.1% of opens and risks the Suggested view is not worth it.
+3. **Check the principles and contested decisions** that apply.
+ If your change reverses a documented decision, say so and bring evidence.
+4. **Make the change in both surfaces**, or say explicitly why not.
+5. **Lock behavior with React Testing Library tests** at the call sites you touched.
+ Agents find this component confusing; RTL tests are the fastest guard.
+ See [testing-patterns](references/testing-patterns.md).
+6. **Decide how you will know it worked** before merging.
+ Ship ordering or default changes behind a flag with a metric and a guardrail.
+ See [measuring-changes](references/measuring-changes.md).
## Pre-change checklist
-- [ ] Read references when relevant: [architecture](references/architecture.md),
- [common-pitfalls](references/common-pitfalls.md) (X/Y matrix),
- [call-sites](references/call-sites-and-blast-radius.md) (smoke tests),
- [testing-patterns](references/testing-patterns.md),
- [performance](references/performance.md) (search plan, reveal barrier)
-- [ ] Decide whether the change must mirror across legacy and rebuild
- (see "Mirroring changes") — if you can only do one, say so explicitly
-- [ ] Test both surfaces if you touched tabs/groups: `legacy-pill`,
- `rebuild-menu`
-- [ ] Confirm shared telemetry payloads still match across both emitters
-- [ ] Ordering / promotion / position-0 -> human sign-off, not agent judgement
-- [ ] If you changed search or loading, verify the plan boundary and confirm
- that optional requests do not delay results
-- [ ] Flag the internal `rebuild-menu` opt-in to the human reviewer
+- [ ] The user problem is linked to evidence (telemetry, replay, ticket)
+- [ ] Change mirrored across legacy and rebuild, or the gap is stated
+- [ ] Both surfaces tested if tabs or groups changed
+- [ ] Shared telemetry payloads still match across both emitters
+- [ ] Ordering, promotion, position-0 or default tab: human sign-off
+- [ ] Search or loading: plan boundary verified, optional requests don't delay results
+- [ ] A success metric and a guardrail metric are named
+- [ ] If you changed the facts, update [product-reality](references/product-reality.md)
```bash
hogli test frontend/src/lib/components/TaxonomicFilter/
```
+
+Keep this skill honest: if the data contradicts it, fix the skill in the same PR.
+Refresh numbers with [refreshing-product-reality](references/refreshing-product-reality.md) when they are older than about three months.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/architecture.md b/.agents/skills/modifying-taxonomic-filter/references/architecture.md
index af247d1da354..84d50d43c1db 100644
--- a/.agents/skills/modifying-taxonomic-filter/references/architecture.md
+++ b/.agents/skills/modifying-taxonomic-filter/references/architecture.md
@@ -2,7 +2,8 @@
There are two architectures living side by side: the **legacy** kea-driven
tree (below) and the **rebuild** (`menu/` + `headless/`, hooks-driven). See
-the "Mirroring changes" table in `SKILL.md` for which concern lives where.
+the mirroring table in [surfaces-and-mirroring](surfaces-and-mirroring.md) for
+which concern lives where.
This file documents both.
## Legacy component tree
@@ -10,7 +11,7 @@ This file documents both.
```text
TaxonomicFilter
├── TaxonomicFilterSearchInput # debounced input + paste detection
-├── CategoryDropdown # A/B-tested suffix picker (variant: 'pill')
+├── CategoryDropdown # suffix category picker (telemetry label variant: 'pill')
└── InfiniteSelectResults
├── Tab buttons # one per visible group, hidden when empty
├── TaxonomicFilterEmptyState
@@ -44,15 +45,15 @@ TaxonomicFilterMenu # menu/ — dropdown + combobox + DWH/Ho
└── fetchTaxonomicListPage
```
-| File | Rebuild counterpart of |
-| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
-| `utils/buildTaxonomicGroups.tsx` | legacy `taxonomicGroups` selector |
-| `hooks/useTaxonomicFilter.ts` | legacy `taxonomicGroupTypes` selector + ordering |
-| `hooks/useGroupList.ts` + `useTaxonomicResource.ts` + `fetchTaxonomicListPage.ts` | legacy `infiniteListLogic.ts` |
-| `hooks/useTaxonomicLocalOverrides.ts` | feeds logic-backed group data the kea version got for free |
-| `hooks/useTaxonomicGroupsContext.ts` | the only kea-coupled layer of the rebuild (reads recents/pinned via bridge) |
-| `menu/DwhFlow.tsx` | legacy DWH config inlined in `InfiniteList.tsx` |
-| `menu/TaxonomicFilterMenu.tsx` | legacy telemetry in `taxonomicFilterLogic.tsx` |
+| File | Rebuild counterpart of |
+| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
+| `utils/buildTaxonomicGroups.tsx` | legacy `taxonomicGroups` selector |
+| `hooks/useTaxonomicFilter.ts` | legacy `taxonomicGroupTypes` selector + ordering |
+| `hooks/useGroupList.ts` + `useTaxonomicResource.ts` + `fetchTaxonomicListPage.ts` | legacy `infiniteListLogic.ts` |
+| `hooks/useTaxonomicLocalOverrides.ts` | feeds logic-backed group data the kea version got for free, and reads recents and pins through kea |
+| `hooks/useTaxonomicGroupsContext.ts` | the group-definition context bridge (recents are written in `useTaxonomicFilter.ts`) |
+| `menu/DwhFlow.tsx` | legacy DWH config inlined in `InfiniteList.tsx` |
+| `menu/TaxonomicFilterMenu.tsx` | legacy telemetry in `taxonomicFilterLogic.tsx` |
`headless/UX_SPEC.md` is the rebuild's design source of truth — update it
when locking design, then build against it.
@@ -63,8 +64,8 @@ when locking design, then build against it.
the parent. See `topMatchesForQuery`, `isSuggestedFilters`, `results`.
The parent only collects matches via `appendTopMatches` on
`infiniteListResultsReceived`.
-- **`PROMOTED_PROPERTIES_BY_SEARCH_TERM` is in `infiniteListLogic.ts`**,
- not in `taxonomicFilterLogic.tsx`.
+- **`PROMOTED_PROPERTIES_BY_SEARCH_TERM` is in `utils/promoteProperties.ts`**,
+ not in `infiniteListLogic.ts` or `taxonomicFilterLogic.tsx`.
- **Pinned/recent rows carry `_pinnedContext` / `_recentContext`** so
`selectItem` records the _original_ `sourceGroupType` in telemetry,
not "Pinned" or "Recents".
diff --git a/.agents/skills/modifying-taxonomic-filter/references/call-sites-and-blast-radius.md b/.agents/skills/modifying-taxonomic-filter/references/call-sites-and-blast-radius.md
index ff7ba285ba61..583b636d5009 100644
--- a/.agents/skills/modifying-taxonomic-filter/references/call-sites-and-blast-radius.md
+++ b/.agents/skills/modifying-taxonomic-filter/references/call-sites-and-blast-radius.md
@@ -39,4 +39,4 @@ shipping anything broad.
- [ ] Add a filter inside Replay's universal filter bar
- [ ] Add a cohort field condition
- [ ] Open the property selector inside Web analytics conversion goal
-- [ ] Check all three surfaces (`legacy-control`, `legacy-pill`, `rebuild-menu`) if you touched tab rendering. Reach the rebuild via a call site that goes through `TaxonomicPopover` or `TaxonomicPropertyFilter` with `TAXONOMIC_FILTER_MENU_REBUILD` on — call sites with their own popover (e.g. `ActionFilterRow`) never render it
+- [ ] Check both surfaces (`legacy-pill`, `rebuild-menu`) if you touched tab rendering. Reach the rebuild via a call site that goes through `TaxonomicPopover` or `TaxonomicPropertyFilter` with `TAXONOMIC_FILTER_MENU_REBUILD` on. `ActionFilterRow` goes through `TaxonomicPopover`, so it reaches the rebuild too; only a call site with a fully separate popover implementation never renders it
diff --git a/.agents/skills/modifying-taxonomic-filter/references/common-pitfalls.md b/.agents/skills/modifying-taxonomic-filter/references/common-pitfalls.md
index e6a43e2acb56..960a1bea6af5 100644
--- a/.agents/skills/modifying-taxonomic-filter/references/common-pitfalls.md
+++ b/.agents/skills/modifying-taxonomic-filter/references/common-pitfalls.md
@@ -5,17 +5,17 @@ component-specific traps.
## "If you change X, also check Y"
-| Change | Verify |
-| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Tab ordering or visibility | Keyboard nav (Tab cycles), default active tab, all three surfaces (`legacy-control`, `legacy-pill`, `rebuild-menu`), suggested-filters tab; mirror the change in `buildTaxonomicGroups.tsx` + `useTaxonomicFilter.ts` |
-| `PROMOTED_PROPERTIES_BY_SEARCH_TERM` or sort order | `$email` and `$current_url` still at position 0 for `email` / `url` searches |
-| Selectors feeding `topMatchesForQuery` | Per-tab output **and** parent `appendTopMatches` aggregation; SuggestedFilters tab still populates |
-| Search input or paste handling | `inputMode` field on `taxonomic_filter_search_query` still distinguishes typed/pasted/mixed |
-| `selectItem` logic | Telemetry payload (`sourceGroupType`, `wasFromRecents`, `wasFromPinnedList`, `wasQuickFilter`, `position`); recents still recorded; `onChange` still fires |
-| Persistence keys (recents or pinned) | Team-id prefix still applied; items don't leak across teams |
-| Filter open/close lifecycle | `cache.openedAt` / `cache.hadSelection` still set; `taxonomic filter closed` still fires with `dwellMs` and `hadSelection` |
-| Adding a `TaxonomicFilterGroupType` | Group config in `taxonomicFilterLogic.tsx`, shortcut routing, telemetry includes the new type, every consumer's `taxonomicGroupTypes` prop updated |
-| Reactive prop behavior in any logic | Use `propsChanged` + `afterMount`, not subscriptions (see below) |
+| Change | Verify |
+| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Tab ordering or visibility | Keyboard nav (Tab cycles), default active tab, both surfaces (`legacy-pill`, `rebuild-menu`), suggested-filters tab; mirror the change in `buildTaxonomicGroups.tsx` + `useTaxonomicFilter.ts` |
+| `PROMOTED_PROPERTIES_BY_SEARCH_TERM` or sort order | `$email` and `$current_url` still at position 0 for `email` / `url` searches |
+| Selectors feeding `topMatchesForQuery` | Per-tab output **and** parent `appendTopMatches` aggregation; SuggestedFilters tab still populates |
+| Search input or paste handling | `inputMode` field on `taxonomic_filter_search_query` still distinguishes typed/pasted/mixed |
+| `selectItem` logic | Telemetry payload (`sourceGroupType`, `wasFromRecents`, `wasFromPinnedList`, `wasQuickFilter`, `position`); recents still recorded; `onChange` still fires |
+| Persistence keys (recents or pinned) | Team-id prefix still applied; items don't leak across teams |
+| Filter open/close lifecycle | `cache.openedAt` / `cache.hadSelection` still set; `taxonomic filter closed` still fires with `dwellMs` and `hadSelection` |
+| Adding a `TaxonomicFilterGroupType` | Group config in `taxonomicFilterLogic.tsx`, shortcut routing, telemetry includes the new type, every consumer's `taxonomicGroupTypes` prop updated |
+| Reactive prop behavior in any logic | Use `propsChanged` + `afterMount`, not subscriptions (see below) |
Suggested-filters items appear in API-response order; don't assert on
order within that tab unless you control the timing.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/contested-decisions.md b/.agents/skills/modifying-taxonomic-filter/references/contested-decisions.md
new file mode 100644
index 000000000000..47e1c47d45ef
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/contested-decisions.md
@@ -0,0 +1,66 @@
+# Contested decisions
+
+These questions come up again and again.
+Each entry records the position the picker currently takes, the evidence for and against it, and how to test it if you want to reverse it.
+Bring evidence, not seniority.
+
+## Should the picker reopen on the last category used?
+
+- **Current position:** no.
+ For an ordinary selection, legacy reopens on Suggested and the rebuild reopens on its `all` scope (`comboboxAllState` in `menu/TaxonomicFilterMenu.tsx`).
+ Exceptions: with no selection the rebuild opens its top-level menu; HogQL and data warehouse selections reopen in their edit flows (`resolveSelectedOpenState` in `menu/TaxonomicFilterMenu.tsx`); legacy reopens a group in `OPEN_AS_SELF_ON_REOPEN` (`types.ts`) on itself.
+- **For changing:** about 24% of users who click a category tab click the same tab again on a later day (about 9% of legacy picker users), over 90 days to 2026-10-15.
+ Source: [Query 15](refreshing-product-reality.md#15-users-who-return-to-the-same-tab).
+ An earlier draft said 44% and 11% with no recorded query, and no definition tried since reproduces them.
+- **Against changing:** a remembered tab is a hidden mode.
+ The biggest measured failure is a category active while searching for something in another group.
+ Recents already put the last pick at the top.
+- **To test:** run it behind a flag.
+ Primary metric: engaged opens ending in a selection.
+ Guardrails: empty-result rate, category-then-empty rate.
+
+## Is the picker "the email or URL box"?
+
+- **Current position:** email and URL get promoted to row 0.
+- **Evidence:** they are the two biggest properties (~38% of chosen values).
+ Custom properties are bigger as a group (~42%).
+ Just under half of users never filter on email or URL in two weeks.
+- **Implication:** promoting them is right.
+ Designing only for them is not.
+
+## Should categories be visible by default?
+
+- **Current position:** hidden behind a category pill, with an optional docked rail.
+- **Evidence:** ~96% of engaged opens never select a real category.
+ About 1% of closes have the docked preference on, with a slightly lower pick rate (~79% vs ~86%).
+ The preference persists, so this includes single-group pickers where no rail shows.
+ An earlier experiment saw better retention for new users with hidden categories.
+ The effect faded when existing users were included.
+- **Implication:** keep hidden by default and keep the rail for those who want it.
+
+## Should power-user features stay?
+
+- **Current position:** keep niche features that are cheap.
+- **Evidence:** thin.
+ Docking and include-stale have small, stable use.
+ No data isolates power users.
+- **Implication:** removing a cheap feature saves little.
+ Removing an expensive one with almost no use saves a lot.
+ Event match calls a model only for uncached empty searches, so measure its real call volume first.
+
+## Should there be a natural-language or chat input?
+
+- **Current position:** no chat input in the picker.
+- **Evidence:** chat isn't discoverable: you have to know what to ask.
+ Research shows natural-language interfaces are faster but less accurate, and users trust them too much.
+ Some users already rescue themselves by asking PostHog AI.
+- **To test:** let search accept a sentence and show the interpreted filter, editable.
+ Measure pick rate and the share of interpreted filters the user edits or undoes.
+
+## Should users be able to pin anything?
+
+- **Current position:** yes, via the pin toggle.
+- **Evidence:** pins drive ~4% of selections.
+ Pin use doesn't change struggle rates.
+- **Implication:** keep pins cheap.
+ Don't give them their own tab.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/design-principles.md b/.agents/skills/modifying-taxonomic-filter/references/design-principles.md
new file mode 100644
index 000000000000..814ebe169e56
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/design-principles.md
@@ -0,0 +1,70 @@
+# Design principles
+
+Principles for picker changes, each grounded in the picker's own data and in published search and UX research.
+Use them to argue for or against a change.
+If your change breaks one, say so in the PR and bring evidence.
+
+## 1. Recognition beats recall
+
+Users pick far more often from what they can see (Suggested, recents, the top rows) than from what they have to remember.
+Recents users struggle much less.
+Nielsen's heuristic of recognition over recall says the same.
+
+**So:** show likely items before the user types.
+Don't make people know which group a thing lives in.
+
+## 2. No hidden modes
+
+A selected category silently narrows search, and that is the biggest measured failure.
+Research on mode errors finds the same: users forget a mode they can't see while they are focused on the task.
+
+**So:** if state changes what search returns, make it visible at the point of typing, or don't let it narrow search at all.
+
+## 3. Never a dead end
+
+Most empty results are the right word in the wrong scope.
+Baymard's e-commerce search research finds "no results" pages are a top cause of abandonment, and suggestions on them recover a large share.
+
+**So:** an empty state shows where the term exists, close matches, or a way to add it.
+A bare "no results" is a bug.
+
+## 4. The top of the list is the product
+
+About half of picks are row 0 and most are in the top three.
+Searchers mostly look at the first few results.
+
+**So:** ranking changes are high-stakes.
+A good item at row 6 is nearly invisible.
+Demoting a popular item is a regression.
+
+## 5. Users search with their words, not ours
+
+Users type `email`, `user`, `url`, and type-names like `person`.
+The vocabulary problem (Furnas et al.) shows two people pick the same word for a thing well under a fifth of the time.
+
+**So:** map common words and synonyms to the right items.
+Treat a group name typed as a query as a request to see that group.
+
+## 6. Fast, but honest about failure
+
+p50 latency is fine.
+Slow tails and silent failures hurt more than the median.
+Users tolerate a short wait when they can see progress, and give up when a failure looks like loading or like "no results".
+
+**So:** show the first usable results without waiting for optional requests, and show an error with a retry when a request fails.
+
+## 7. Engineers trust what they can check
+
+Many users are engineers who read the filter they built.
+Research on natural-language and AI interfaces finds people over-trust confident output and miss errors.
+
+**So:** any AI or natural-language help should produce a normal, editable filter the user can see before it applies.
+Don't hide the interpretation.
+
+## 8. Defaults serve most users; options serve the rest
+
+Most users never open a category.
+A minority dock the rail or use include-stale.
+
+**So:** design defaults for the majority.
+Keep cheap options for the minority, and don't let them complicate the default path.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/evidence-sources.md b/.agents/skills/modifying-taxonomic-filter/references/evidence-sources.md
new file mode 100644
index 000000000000..47b4c2d0e7ea
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/evidence-sources.md
@@ -0,0 +1,78 @@
+# Evidence sources
+
+Where to look before you decide a change is worth making, and what each source is good and bad at.
+Use more than one: telemetry says what happened, replay says why, tickets say what hurt enough to report.
+
+All of these live in PostHog's own project (project 2 on us.posthog.com).
+Use the PostHog MCP (`posthog:execute-sql`, dashboards, vision scanners, conversations) to query them.
+
+## Telemetry
+
+- Events: see [telemetry-contract](telemetry-contract.md) for names and properties.
+- Queries: [refreshing-product-reality](refreshing-product-reality.md).
+- Live values: the `taxonomic_filter_*` metrics in the data catalog, run with `posthog:data-catalog-metric-run`.
+- **Good for:** sizing a problem, comparing surfaces, before and after.
+- **Bad for:** intent.
+ A close without a pick can be success (the user only looked) or failure.
+- **Watch for:** staff traffic, `groupType` vs `sourceGroupType`, and open-level splits covering engaged legacy opens only.
+
+## The health dashboard
+
+The "Taxonomic filter health" dashboard tracks selection rate, position, empty results and recovery, latency, fetch failures, and the category-then-empty trap.
+
+- **Good for:** trends and spotting regressions after a deploy.
+- **Bad for:** causes.
+ Some tiles include staff traffic.
+ A mean dwell tile is skewed by long idle opens; prefer percentiles.
+
+## Replay Vision scanners
+
+Two scanners watch sampled sessions that open the picker:
+
+- A **classifier** tags each session as success, struggle or abandoned, with reasons and cited moments.
+- A **summarizer** describes how the user browsed and picked.
+
+Results arrive as `$recording_observed` events.
+Tags are in `scanner_output_tags`, cited moments in `scanner_output_reasoning_segments`.
+
+- **Good for:** why a pattern happens, and failures telemetry misses.
+- **Bad for:** exact rates.
+ It is a sample, and prompt versions change.
+ Compare within one scanner version.
+- "Abandoned" often means opened and dismissed.
+ Read the reasoning.
+
+## Support tickets
+
+PostHog conversations tickets mentioning the picker, filters or specific property names.
+
+- **Good for:** what customers care about enough to report.
+- **Bad for:** prevalence.
+ Few people file tickets.
+- Recent themes: UI bugs, missing items, wrong category.
+ Almost never slowness.
+
+## GitHub issues and pull requests
+
+Search `PostHog/posthog` for "taxonomic", "property filter", and the component paths.
+
+- **Good for:** known bugs, past attempts, and why earlier decisions were made.
+- **Bad for:** customer impact.
+ Most picker issues are filed by staff.
+
+## Research
+
+Useful published work for picker decisions:
+
+- Nielsen Norman Group: recognition over recall, mode errors, search results behavior.
+- Baymard Institute: no-results pages, autocomplete, search scope.
+- Furnas et al., "The vocabulary problem in human-system communication" (1987).
+- Studies of natural-language and AI interfaces: faster, but less accurate and prone to over-trust.
+
+See [design-principles](design-principles.md) for how these apply.
+
+## Opinions
+
+Issues, Slack threads and people who have worked on the picker carry useful hypotheses.
+Treat them as hypotheses.
+Several long-held beliefs about this picker turned out to be right in direction and wrong in size when checked against data.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/failure-modes.md b/.agents/skills/modifying-taxonomic-filter/references/failure-modes.md
new file mode 100644
index 000000000000..2a0a47687da3
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/failure-modes.md
@@ -0,0 +1,92 @@
+# Failure modes
+
+The ways the picker fails users, ranked roughly by how many people they hit.
+Each entry says how to spot it in data and what a fix should do.
+
+## 1. The hidden category trap
+
+A user picks a category, then searches for something that lives in another group, and gets nothing.
+
+- **Signal:** a category pick followed by an empty result is ~9x more common than the reverse order.
+ ~11% of opens with a category pick have an empty result after the pick, vs ~3% of opens without one.
+ Selection rate drops ~23 points (~62% vs ~85%).
+- **Caveat:** the ~3% is too low.
+ Opens that stay on Suggested send no empty-result event, so their empty states are not counted.
+ The same gap pushes the ~9x order ratio up, because an empty search on Suggested before a category pick is never counted.
+ The selection drop does not use empty-result events, so lean on it first.
+- **Why:** the active category silently narrows search.
+ Users don't hold the category in mind once they start typing.
+- **Fix direction:** search all groups even when a tab is active.
+ Show the active tab's results first, then matches from other groups.
+ Never show a bare "no results" when other groups match.
+
+## 2. Right word, wrong scope
+
+Most empty searches are real words that exist somewhere else.
+
+- **Signal:** the top empty queries are terms like `email`, `url`, `last seen`, `person` typed in a group that doesn't hold them.
+- **Signal:** users type type-names as queries: `person`, `event`, `user`, `cohort`, `group`.
+ They are trying to navigate by searching.
+- **Fix direction:** the empty state should say where the term was found ("found in Person properties") and offer one click to go there.
+ Treat a type-name query as a request to show that group.
+
+## 3. Poor recovery after an empty result
+
+- **Signal:** the health dashboard's recovery tile fell from ~46% to ~39% over three months, while the empty-result rate stayed flat.
+- **Caution:** that tile pools both surfaces, and they record different empty states.
+ A change in the rebuild share can move it on its own.
+ Check each surface with query 12 in [refreshing-product-reality](refreshing-product-reality.md) before you call it a worse empty state.
+ Today legacy recovers ~26% and the rebuild ~16%.
+- **Fix direction:** same as above, and measure recovery directly.
+ See [measuring-changes](measuring-changes.md).
+
+## 4. Failed requests
+
+- **Signal:** `taxonomic filter fetch failed` ~0.2 times per 100 legacy search queries (query 10).
+ One search can send several events, so this is not a share of failed searches.
+ The health dashboard shows ~2%, but it divides every failure, first loads included, by timed searches, so it overstates the rate.
+ Events, cohorts, person properties and flags fail most.
+ Some pseudo-category groups fail more often than they are picked.
+ First-load failures have only been captured since 2026-09-13, so compare from then on.
+- **Why it matters:** a failure that looks like loading or like "no results" sends users away, and a 403 must not look like a slow request.
+- **Current state:** both surfaces end loading and show "Couldn't load results" with a retry, except for a 403.
+ Legacy does it in `InfiniteList.tsx` (`InfiniteListErrorState`), the rebuild in `menu/Combobox.tsx` from `showErrorState` in `hooks/useGroupList.ts`.
+ Legacy's `remoteFetchForbidden` (`infiniteListLogic.ts`) shows an access-denied message with no retry for a `permission_denied` 403.
+ The rebuild has no equivalent, so a 403 there shows the generic retry instead.
+ Keep the two in parity, and reduce the failures themselves.
+ See [performance](performance.md).
+
+## 5. Slow tails on a few groups
+
+- **Signal:** `taxonomic filter search latency` (`time_to_see_data_ms`). p50 is ~200ms overall.
+ Persons search has a p90 of ~4s and a p99 over 10s.
+ Pageview URLs also have a slow p99.
+- **Note:** customers rarely report slowness.
+ Fix it, but don't rank it above failure modes 1 to 4 without evidence.
+
+## 6. Items that don't exist yet
+
+- **Signal:** about a third of picker support tickets.
+ Users want to target a person property before any event has sent it, or can't find a distinct ID in replay filters.
+- **Fix direction:** allow typing a custom key where the backend accepts it, and say plainly that it hasn't been seen yet.
+
+## 7. Broken UI in specific scenes
+
+- **Signal:** the largest ticket theme.
+ Popover placement, options that can't be clicked or scrolled, crashes in `infiniteListLogic`, and crashes in data-warehouse flows.
+- **Fix direction:** reproduce on the reporter's surface first (see [surfaces-and-mirroring](surfaces-and-mirroring.md)).
+ Add an RTL regression test at that call site.
+
+## 8. The weakest big tab: person properties
+
+- **Signal:** ~64% of closes on it end in a selection (~86% across all tabs), the lowest of the large tabs.
+ This counts the tab open at close, so read it as direction (see query 13 in [refreshing-product-reality](refreshing-product-reality.md)).
+ Average selected position is far down the list.
+ It is also the top scope for empty queries.
+- **Fix direction:** rank properties seen on the chosen event or recently used higher, and separate system from custom properties.
+
+## What "abandoned" means in replay
+
+The replay classifier tags some sessions as abandoned.
+About half of those describe the user opening and dismissing the picker without a struggle signal.
+Count empty results, reopens and retyping before calling an abandoned session a failure.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/feature-inventory.md b/.agents/skills/modifying-taxonomic-filter/references/feature-inventory.md
new file mode 100644
index 000000000000..5d9c25385bef
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/feature-inventory.md
@@ -0,0 +1,54 @@
+# Feature inventory
+
+Every user-facing feature of the picker, how much it is used, and its current status.
+Ratios come from the queries in [refreshing-product-reality](refreshing-product-reality.md), with the windows set there (2026-10), on the legacy picker unless a row says otherwise.
+Update this file when you add, remove or change a feature.
+
+Status meanings:
+
+- **Protect:** carries real use.
+ Changes need a metric and a guardrail.
+- **Improve:** used, with a measured weakness.
+- **Fix:** broken or failing for a measurable share of users.
+- **Keep:** small, cheap and harmless.
+- **Candidate for removal:** low use relative to cost.
+ Removal still needs the checks in "Before removing anything".
+
+| Feature | Use | Status | Notes |
+| ----------------------------------------------------------------------------------------- | -------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------- |
+| Suggested view (default) | ~70% of selections | Protect | It is the product. |
+| Recents inside Suggested | ~40% of selections | Protect, improve | Stored per browser. Syncing per user would help people on several machines. |
+| Search | ~55% of selections involve it | Protect | See [failure-modes](failure-modes.md) 1 and 2. |
+| Email and URL promotion | Row 0 for the top terms | Protect | `PROMOTED_PROPERTIES_BY_SEARCH_TERM`. Human sign-off to change. |
+| Event properties tab | Large | Improve | Ranking: selected items sit far down the list. |
+| Person properties tab | Large, ~64% of closes on it pick (query 13, final tab) | Improve | Weakest big tab. |
+| Empty-result state | ~5 per 100 search queries (query 13) | Fix | Should show matches in other groups. Suggested is not counted. |
+| Fetch error handling | ~0.2 failure events per 100 search queries (query 10) | Keep | Both surfaces show an error with retry. Keep them in parity. |
+| Persons search latency | p90 ~4s | Fix | Slowest group. |
+| Custom key for unseen properties | Ticket theme | Fix | Flags and cohorts especially. |
+| Pin toggle | ~4% of selections come from pins | Keep | Cheap. |
+| Recents tab (standalone) | ~0.3% of closes (query 13) | Candidate for removal | Same items already in Suggested. ~36% of closes on it pick, vs ~86% overall (final-tab association, query 13). |
+| Pinned tab (standalone) | ~0.06% of closes (query 13) | Candidate for removal | Keep the pin toggle. |
+| Pseudo-category tabs (autocapture, pageview, screen, email addresses, elements, metadata) | Each under 3% of category clicks (query 14, click mix) | Candidate for removal as tabs | Their **items** are picked through Suggested and search (`sourceGroupType`). Keep them as sources. |
+| Event match suggestion (model call) | ~5-8% of answers shown (rough); ~7% of sessions pick one | Candidate for removal or redesign | Calls a model only for an uncached empty search. Measure uncached calls before judging cost. |
+| Search intent switch banner | ~1 in 6 shown banners lead to a switch | Decide from its experiment | Promotion of the predicted group happens without the banner. |
+| Category rail docking | ~1% of closes have docking on (query 13, preference) | Keep | Pick rate ~79% docked vs ~86% undocked. |
+| Include stale toggle | Small, steady | Keep | Cheap. |
+| Rebuild menu (`TAXONOMIC_FILTER_MENU_REBUILD`) | Some customers still see it | Finish or turn off | Selection rate looks lower than legacy, but the rebuild counts every close and legacy only engaged ones. |
+
+## Before removing anything
+
+1. Measure use by `sourceGroupType`, not only by `groupType`.
+ A tab can be unused while its items are picked every day through Suggested.
+2. Separate "rarely used" from "failing".
+ If a group's fetches fail, fix them before judging use.
+3. Check both surfaces and every call site that passes the group.
+ See [call-sites-and-blast-radius](call-sites-and-blast-radius.md).
+4. Check for a running experiment on the feature.
+5. Keep the telemetry event (or retire it on purpose) so dashboards don't silently go flat.
+ See [telemetry-contract](telemetry-contract.md).
+6. Follow the low-usage rule in the repo's `AGENTS.md` before you remove a feature for low use.
+ Query its usage over the last 6 months.
+ Trigger the feature locally and confirm its events arrive, because missing events can mean broken tracking.
+ Post the feature and its usage numbers in the platform UX Slack channel, and wait for the keep or remove decision there.
+ Do not remove it before that decision.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/measuring-changes.md b/.agents/skills/modifying-taxonomic-filter/references/measuring-changes.md
new file mode 100644
index 000000000000..301b0d18abaa
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/measuring-changes.md
@@ -0,0 +1,40 @@
+# Measuring a change
+
+Decide before merging how you will know a change worked.
+Picker changes are easy to ship and hard to judge after the fact.
+
+## Metrics that matter
+
+| Metric | What it tells you | Direction |
+| -------------------------------------- | ---------------------------------- | ------------------------ |
+| Engaged opens ending in a selection | Overall success | Up |
+| Position of the selected row | Ranking quality | Lower is better |
+| Empty-result rate | Search coverage and scope mismatch | Down |
+| Category-then-empty rate | The hidden-mode failure | Down |
+| Recovery within 30s of an empty result | Empty-state quality | Up |
+| Select-then-reopen within 60s | First pick was wrong | Down, but read with care |
+| Search latency p90 and p99 by group | Speed | Down |
+| Fetch failure events per search query | Reliability | Down |
+| Replay classifier success share | Observed friction | Up |
+
+The health dashboard (see [evidence-sources](evidence-sources.md)) has most of these as tiles.
+
+## Guardrails
+
+- Any ordering, default or promotion change: watch row-0 share, opens ending in a selection, and the Suggested view's share of picks.
+- Any change to a group: watch that group's item use (`sourceGroupType`), not just its tab use.
+- Any change in one surface: compare both surfaces on the shared events.
+
+## Experiments
+
+- Ship behind a feature flag and use a PostHog experiment when the change touches defaults, ordering or what Suggested shows.
+- Run long enough to include returning users.
+ Effects on new users can disappear once existing users are included.
+- Prefer a real control arm.
+ An arm that changes the same thing in a different way can't tell you whether the change helps.
+
+## After shipping
+
+- Check replay evidence a week later.
+ The classifier and summarizer catch failures telemetry misses.
+- Update [product-reality](product-reality.md) and [feature-inventory](feature-inventory.md) if the facts changed.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/performance.md b/.agents/skills/modifying-taxonomic-filter/references/performance.md
index 9929b7dcb3fb..f9b35804dff3 100644
--- a/.agents/skills/modifying-taxonomic-filter/references/performance.md
+++ b/.agents/skills/modifying-taxonomic-filter/references/performance.md
@@ -1,8 +1,38 @@
# TaxonomicFilter performance
Use this reference when you change TaxonomicFilter search, loading, pagination, or result reveal behavior.
-For the full profiling workflow, use
-[`profiling-slow-api-endpoints`](../../profiling-slow-api-endpoints/SKILL.md).
+For the full profiling workflow, use [`profiling-slow-api-endpoints`](../../profiling-slow-api-endpoints/SKILL.md).
+
+## Where users wait
+
+Measured with `taxonomic filter search latency` (`time_to_see_data_ms`).
+Only the legacy picker sends it, so these numbers say nothing about the rebuild.
+Refresh with query 9 in [refreshing-product-reality](refreshing-product-reality.md).
+
+- The median search is fast (~200ms) in every large group.
+- The slow tail is concentrated.
+ Persons search has a p90 of ~4s and a p99 over 10s.
+ Pageview URLs have a slow p99.
+- Customers rarely report slowness.
+ Failures that look like loading or like "no results" hurt more (see below).
+ Rank latency work against [failure-modes](failure-modes.md), not on its own.
+
+## A failed request must show as an error
+
+`taxonomic filter fetch failed` fires ~0.2 times per 100 legacy search queries (query 10).
+One search can send several events, so this is not a share of failed searches.
+The health dashboard shows ~2%, but it divides every failure, first loads included, by timed searches, so it overstates the rate.
+Cohorts, events, person properties and flags make up most of the failures.
+Both surfaces end loading on a failure and show "Couldn't load results" with a retry, except for a 403.
+A 403 must not look like "no results".
+
+- Legacy: `InfiniteListErrorState` in `InfiniteList.tsx`, fed by `infiniteListLogic.ts`.
+ Its `remoteFetchForbidden` shows an access-denied message with no retry for a `permission_denied` 403.
+- Rebuild: the error block in `menu/Combobox.tsx`, fed by `showErrorState` from `hooks/useGroupList.ts`.
+ `useGroupList` keeps `showErrorState` and `showEmptyState` apart, so a failure never reads as an empty result.
+ It has no forbidden handling, so a 403 shows the generic retry instead of legacy's access-denied message.
+- Keep `taxonomic filter fetch failed` firing with `groupType`, `searchQuery` and `surface` on both surfaces.
+ The rebuild sends no `groupType` on its `all`, `recent` and `pinned` scopes, so per-group analysis stays on legacy.
## Backend search plan
@@ -39,7 +69,8 @@ Check both `infiniteListLogic.ts` and `hooks/useGroupList.ts` because the legacy
- Compare both Postgres predicate forms with safe production `EXPLAIN` queries.
- State whether each measured query used a warm or cold cache.
- Run the definition API tests against Postgres.
-- Test the legacy and rebuild loading paths.
+- Test the legacy and rebuild loading paths, including a failed request.
+- After shipping, compare p90 and p99 by group and the fetch failure rate.
Result tests alone do not protect the plan choice because both plans return the same rows.
When plan selection changes, test the boundary, cache failure, and SQL shape.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/product-reality.md b/.agents/skills/modifying-taxonomic-filter/references/product-reality.md
new file mode 100644
index 000000000000..29ebec1c8e34
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/product-reality.md
@@ -0,0 +1,134 @@
+# Product reality
+
+How users actually use the picker, from production telemetry, replay review and support tickets.
+Ratios only: this is a public repo.
+
+**Last refreshed 2026-10-15.**
+Telemetry is a 90-day window unless a line says otherwise.
+Re-run with [refreshing-product-reality](refreshing-product-reality.md) when this is older than about three months.
+Most figures here have a live `taxonomic_filter_*` metric in the PostHog data catalog (listed in that guide).
+The numbers below are a snapshot for orientation: before a figure drives a decision, run its metric for the current value.
+
+## How users pick
+
+- **~85% of engaged opens end in a selection.** p50 dwell ~5.5s, p90 ~23s.
+ Most engaged opens are quick and successful.
+- "Engaged" means the user interacted.
+ The legacy picker sends `taxonomic filter closed` only when `hadInteraction` is true, so an open dismissed untouched is not counted.
+ The rate over all opens is lower.
+- The previous figure (~34%, May 2026) came from before close telemetry was complete.
+ Don't compare the two numbers as a trend.
+- **Position is everything.**
+ Row 0 takes ~52% of picks, row 1 ~23%, row 2 ~10%.
+ About 85% of picks are in the top three rows.
+ These are legacy figures: the rebuild's `all` scope counts recents and pinned rows in its positions, so its numbers do not compare.
+- **~96% of engaged opens never select a real category** (7-day sample, legacy picker, sessions split at each `taxonomic filter closed`).
+- **Suggested carries about 70% of selections** (legacy picker).
+ Just over half of those are recents.
+
+## Selection paths
+
+Legacy picker only (query 5 leaves out `rebuild-menu`).
+These overlap: one pick can be both searched and from recents.
+
+| Path | Share of selections |
+| ---------------------------- | ------------------- |
+| Had search input | ~55% |
+| From recents | ~40% |
+| Browsed, no search or recent | ~16% |
+| From pinned | ~4% |
+
+Recents matter more than search share suggests.
+In replay review, sessions that used a recent were classed as struggling or abandoned one third to one half as often as sessions that didn't, at every experience level.
+
+## What users select (`sourceGroupType`)
+
+`sourceGroupType` is where the item lives.
+`groupType` is the tab that was active.
+Use `sourceGroupType` when judging whether a group is used, or you'll undercount anything reached through Suggested.
+
+| Source group type | Share |
+| ------------------- | ----- |
+| `events` | ~40% |
+| `event_properties` | ~30% |
+| `person_properties` | ~15% |
+| `event_metadata` | ~3% |
+| `cohorts` | ~2% |
+| `email_addresses` | ~2% |
+| `pageview_urls` | ~1% |
+| `actions` | ~1% |
+| everything else | <1% |
+
+## What users search for (share of top-8 terms)
+
+| Term | Share |
+| -------- | ----- |
+| `email` | ~19% |
+| `user` | ~16% |
+| `url` | ~14% |
+| `utm` | ~13% |
+| `app` | ~10% |
+| `page` | ~10% |
+| `person` | ~9% |
+| `s` | ~9% |
+
+`email` and `url` are still the biggest single terms, which is why `PROMOTED_PROPERTIES_BY_SEARCH_TERM` promotes `$email` and `$current_url` to row 0.
+They are no longer half of the top 8.
+
+## What values users filter on
+
+No query in [refreshing-product-reality](refreshing-product-reality.md) reproduces these figures.
+Picker telemetry does not record which property key or value was chosen, so they come from a separate one-off analysis of chosen filters (2026-10, two-week window).
+A refresh that cannot re-derive them should mark them as stale, not carry them forward.
+
+- Email and URL properties are ~38% of chosen property values.
+- Custom (non-`$`) properties are ~42% as a group.
+- About half of users who filter use email or URL at all in two weeks.
+ Roughly a third use only those.
+
+So promote email and URL, but don't design only for them.
+
+## Where it goes wrong
+
+Summary only.
+Detail in [failure-modes](failure-modes.md).
+
+- Category picked, then a search that finds nothing: ~11% of opens with a category pick have an empty result after the pick, vs ~3% of opens without one.
+ The ~3% is too low: Suggested sends no empty-result event.
+- Opens with a category pick end in a selection ~62% of the time, vs ~85% without one.
+- Most empty searches are ordinary words in the wrong scope.
+- Recovery within 30s of an empty result fell from ~46% to ~39% (Jul to Oct 2026, health dashboard session tile) while the empty-result rate stayed flat.
+ The tile pools both surfaces, so check each one with query 12 before you read it as a worse empty state.
+- About 0.2 fetch failure events per 100 legacy search queries (query 10).
+ One search can send several, so this is not a share of failed searches.
+ The health dashboard shows ~2%, but it divides every failure, first loads included, by timed searches, so it overstates the rate.
+ Cohorts, events, person properties and flags make up most of the failures.
+- Person properties is the weakest big tab: ~64% of closes on it end in a selection, vs ~86% across all tabs.
+ This counts the tab open at close, so read it as direction (see query 13).
+
+## What customers report
+
+Support tickets mentioning the picker, by theme (12 months):
+
+| Theme | Share of tickets |
+| ---------------------------------------- | ---------------- |
+| UI bugs: placement, can't click, crashes | ~45% |
+| Missing items (not yet ingested, hidden) | ~33% |
+| Wrong category or type | ~23% |
+| Slowness | none |
+
+Engineering latency data shows real slow tails (see [performance](performance.md)).
+Customers don't name it as the problem.
+
+## Input mode
+
+~93% typed, ~7% pasted.
+
+## Caveats
+
+- The open-level splits cover engaged legacy opens only.
+ A picker that stays mounted can merge several opens into one, so treat those ratios as direction.
+- Some dashboard tiles include staff traffic.
+ Filter it when it matters.
+- Replay classifier results are a sample, and the prompt has changed over time.
+ Compare within one scanner version.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/refreshing-product-reality.md b/.agents/skills/modifying-taxonomic-filter/references/refreshing-product-reality.md
index ab987942de46..e6bbdcdfb2df 100644
--- a/.agents/skills/modifying-taxonomic-filter/references/refreshing-product-reality.md
+++ b/.agents/skills/modifying-taxonomic-filter/references/refreshing-product-reality.md
@@ -1,13 +1,39 @@
-# Refreshing the Product reality section
+# Refreshing product reality
-Re-run these every ~3 months. **Public OSS repo: convert to ratios before
-writing back — never commit absolute event or user counts.** All queries
-use a 90-day window; keep that consistent so trends are comparable.
+Re-run these every ~3 months and update [product-reality](product-reality.md).
+**Public OSS repo: convert to ratios before writing back.
+Never commit absolute event or user counts.**
+
+Queries 1 to 7 use a 90-day window; keep that consistent so trends are comparable.
+Queries 8 to 12 use 7 days because they are heavier.
+Queries 13 to 15 use 90 days.
+
+Exclude staff when the question is about customers, for example with the project's test account filters.
+
+## Live metrics
+
+Nine of these queries are saved as metrics in the PostHog data catalog for project 2.
+Run a metric with `posthog:data-catalog-metric-run` to get the current value instead of reading a figure from this skill.
+The metrics are proposed until a person approves them in the data catalog, so treat their results as noncanonical until then.
+The metric and the query here hold the same SQL.
+When you change one, change the other in the same PR (`posthog:data-catalog-metric-update` for the metric).
+
+| Query | Metric |
+| ----- | ---------------------------------------------------- |
+| 4 | `taxonomic_filter_engaged_selection_rate_by_surface` |
+| 5 | `taxonomic_filter_selection_mix_legacy` |
+| 6 | `taxonomic_filter_row_position_share_legacy` |
+| 8 | `taxonomic_filter_category_trap` |
+| 9 | `taxonomic_filter_search_latency_by_group` |
+| 10 | `taxonomic_filter_fetch_failures_by_group` |
+| 11 | `taxonomic_filter_assistive_funnels` |
+| 12 | `taxonomic_filter_empty_result_recovery_by_surface` |
+| 13 | `taxonomic_filter_tab_use_legacy` |
### 1. Selection breakdown by source group type
-Computes share of all `taxonomic filter item selected` events grouped
-by `sourceGroupType`. Drives the "What users select" table.
+Share of `taxonomic filter item selected` by `sourceGroupType`.
+Drives the "What users select" table.
```sql
SELECT
@@ -29,8 +55,8 @@ LIMIT 30
### 2. Top searches (share of top-N)
-Computes the share of each top-N search term among the top 8 only.
-Avoids exposing absolute search volume.
+Share of each term among the top 8 only.
+Avoids exposing search volume.
```sql
WITH top_terms AS (
@@ -50,63 +76,83 @@ ORDER BY share_pct DESC
### 3. Top empty-result searches
-Reveals taxonomy gaps. Use the qualitative findings (which terms are empty
-in which groups), not absolute counts.
+Reveals scope mismatches.
+Write back the qualitative finding (which terms are empty in which groups), not counts.
+The rebuild sends no `groupType` for its `all`, `recent` and `pinned` scopes, so the query splits by `surface`.
+Read an empty `group_type` on a `rebuild-menu` row as one of those scopes, not as a group.
```sql
SELECT
lower(trim(toString(properties.searchQuery))) AS q,
+ properties.surface AS surface,
properties.groupType AS group_type,
count() AS empties
FROM events
WHERE event = 'taxonomic filter empty result'
AND timestamp >= now() - INTERVAL 90 DAY
-GROUP BY q, group_type
+GROUP BY q, surface, group_type
ORDER BY empties DESC
LIMIT 40
```
### 4. Selection rate and dwell distribution
-Drives the "About one in three opens results in a selection" line, plus
-the dwell-time bullet.
+Measures engaged opens only.
+The legacy picker sends `taxonomic filter closed` only after the user interacts, so untouched dismissals are missing.
+The rebuild sends it on every close, so the query splits by `surface`.
+Write back the `legacy-pill` row as the engaged-open rate.
+`legacy-control` and empty values come only from older clients.
+Never pool the rebuild row with them.
```sql
SELECT
+ properties.surface AS surface,
round(100 * countIf(toBool(properties.hadSelection)) / count(), 1) AS selection_rate_pct,
quantile(0.5)(toFloat(properties.dwellMs)) AS p50_dwell_ms,
quantile(0.9)(toFloat(properties.dwellMs)) AS p90_dwell_ms
FROM events
WHERE event = 'taxonomic filter closed'
AND timestamp >= now() - INTERVAL 90 DAY
+GROUP BY surface
+ORDER BY surface
```
### 5. Selection-source mix
-Drives the "65% involve search / 19% browsed / 16% from recents / <1%
-from pinned" line. Use only the relative shares — drop the absolute counts
-before writing back.
+The buckets overlap.
+Write back relative shares only.
+`from_recents_pct` counts recents from any tab.
+`from_recents_in_suggested_pct` counts only the Suggested tab, which backs the "Recents inside Suggested" row in [feature-inventory](feature-inventory.md).
+`suggested_share_pct` backs the Suggested share, and `recents_share_of_suggested_pct` backs "about half of Suggested picks are recents".
+The rebuild's `all`, `recent` and `pinned` scopes have no `groupType`, so the query is legacy only and every column shares one base.
```sql
SELECT
round(100 * countIf(toBool(properties.hadSearchInput)) / count(), 1) AS had_search_pct,
round(100 * countIf(NOT toBool(properties.hadSearchInput) AND NOT toBool(properties.wasFromRecents) AND NOT toBool(properties.wasFromPinnedList)) / count(), 1) AS browsed_no_search_pct,
round(100 * countIf(toBool(properties.wasFromRecents)) / count(), 1) AS from_recents_pct,
- round(100 * countIf(toBool(properties.wasFromPinnedList)) / count(), 1) AS from_pinned_pct
+ round(100 * countIf(toBool(properties.wasFromRecents) AND properties.groupType = 'suggested_filters') / count(), 1) AS from_recents_in_suggested_pct,
+ round(100 * countIf(toBool(properties.wasFromPinnedList)) / count(), 1) AS from_pinned_pct,
+ round(100 * countIf(properties.groupType = 'suggested_filters') / count(), 1) AS suggested_share_pct,
+ round(100 * countIf(toBool(properties.wasFromRecents) AND properties.groupType = 'suggested_filters')
+ / countIf(properties.groupType = 'suggested_filters'), 1) AS recents_share_of_suggested_pct
FROM events
WHERE event = 'taxonomic filter item selected'
+ AND coalesce(toString(properties.surface), '') != 'rebuild-menu'
AND timestamp >= now() - INTERVAL 90 DAY
```
### 6. Position distribution
-Drives the "first three rows carry ~80% of selections" line.
+Legacy only.
+On the rebuild's merged `all` scope, `position` counts the recents and pinned rows at the top, so it does not match legacy rows.
```sql
WITH positions AS (
SELECT toInt(properties.position) AS pos
FROM events
WHERE event = 'taxonomic filter item selected'
+ AND coalesce(toString(properties.surface), '') != 'rebuild-menu'
AND timestamp >= now() - INTERVAL 90 DAY
AND properties.position IS NOT NULL
)
@@ -121,8 +167,6 @@ LIMIT 10
### 7. Input mode mix
-Drives the "~93% typed / ~7% pasted" line.
-
```sql
SELECT
properties.inputMode AS input_mode,
@@ -141,13 +185,311 @@ GROUP BY input_mode
ORDER BY share_pct DESC
```
+### 8. The category trap (open level)
+
+Splits each session after every legacy `taxonomic filter closed`, so each chunk is close to one engaged legacy open.
+It is not exact: the event fires when the logic unmounts, not when the picker visibly closes.
+A picker that stays mounted (for example in `ColumnConfigurator.tsx`) can put several picks in one chunk, and two mounted pickers can interleave.
+Read the ratios as direction, not as exact rates.
+There is no better open boundary in legacy telemetry today.
+Then it compares opens with and without a category pick.
+Do not split on `taxonomic filter add filter clicked`: it fires only when a property filter row is added, so most opens have no start marker.
+The rebuild is left out, because its close event fires on every close and its category event is different.
+`taxonomic filter category selected` also fires when the user switches to Suggested, Recent or Pinned.
+Those switches do not narrow search, so the query drops them, and "category pick" means a real group.
+The query also drops any open that picked the SQL expression category: legacy commits a SQL expression without sending `taxonomic filter item selected`, so a success there would look like a failure.
+An existing SQL expression filter reopens straight on that tab without a category event, so the query also drops any open whose close has `groupType = 'hogql_expression'`.
+Suggested sends no `taxonomic filter empty result`, so the without-category empty rate is too low.
+The same gap biases `category_then_empty_ratio` upward: an empty search on Suggested followed by a category pick never counts in its base.
+`selection_after_category_pct` and `selection_without_category_pct` do not use empty-result events, so they are the most reliable output of this query.
+Drives failure mode 1 in [failure-modes](failure-modes.md).
+
+```sql
+WITH sessions AS (
+ -- groupArray does not keep row order, so sort explicitly; on a timestamp tie the close sorts last
+ SELECT
+ $session_id AS sid,
+ arrayMap(x -> tupleElement(x, 3), arraySort(groupArray((timestamp, event = 'taxonomic filter closed',
+ -- mark SQL expression picks and closes so their opens can be dropped below
+ multiIf(event = 'taxonomic filter category selected' AND toString(properties.groupType) = 'hogql_expression', 'sql expression category',
+ event = 'taxonomic filter closed' AND toString(properties.groupType) = 'hogql_expression', 'taxonomic filter closed on sql expression',
+ event))))) AS steps
+ FROM events
+ WHERE event IN ('taxonomic filter closed', 'taxonomic filter category selected',
+ 'taxonomic filter empty result', 'taxonomic filter item selected')
+ -- the category event has no surface, and only legacy sends it
+ AND (event = 'taxonomic filter category selected' OR coalesce(toString(properties.surface), '') != 'rebuild-menu')
+ -- a switch to a meta tab does not narrow search
+ AND NOT (event = 'taxonomic filter category selected'
+ AND toString(properties.groupType) IN ('suggested_filters', 'recent_filters', 'pinned_filters'))
+ AND timestamp >= now() - INTERVAL 7 DAY
+ AND $session_id IS NOT NULL
+ GROUP BY sid
+),
+opens AS (
+ -- split after each close, and drop the trailing chunk of an open that has not closed yet
+ SELECT arrayFilter(
+ -- has() needs an exact match, so chunks that close on SQL expression drop out here too
+ c -> has(c, 'taxonomic filter closed') AND NOT has(c, 'sql expression category'),
+ arraySplit((e, prev) -> startsWith(prev, 'taxonomic filter closed'), steps, arrayPushFront(arrayPopBack(steps), ''))
+ ) AS chunks
+ FROM sessions
+),
+per_open AS (
+ SELECT
+ has(chunk, 'taxonomic filter category selected') AS picked_category,
+ has(chunk, 'taxonomic filter empty result') AS had_empty,
+ has(chunk, 'taxonomic filter item selected') AS had_selection,
+ indexOf(chunk, 'taxonomic filter category selected') AS cat_idx,
+ indexOf(chunk, 'taxonomic filter empty result') AS empty_idx,
+ arrayLastIndex(x -> x = 'taxonomic filter empty result', chunk) AS last_empty_idx,
+ arrayLastIndex(x -> x = 'taxonomic filter item selected', chunk) AS last_sel_idx
+ FROM opens
+ ARRAY JOIN chunks AS chunk
+)
+SELECT
+ round(100 * countIf(picked_category) / count(), 1) AS opens_with_category_pct,
+ -- only an empty result after the category pick counts, not one the pick recovered from
+ round(100 * countIf(picked_category AND last_empty_idx > cat_idx) / countIf(picked_category), 1) AS empty_rate_after_category_pct,
+ round(100 * countIf(had_empty AND NOT picked_category) / countIf(NOT picked_category), 1) AS empty_rate_without_category_pct,
+ round(countIf(picked_category AND had_empty AND cat_idx < empty_idx) / countIf(picked_category AND had_empty AND empty_idx < cat_idx), 1) AS category_then_empty_ratio,
+ -- only a pick after the category pick counts
+ round(100 * countIf(picked_category AND last_sel_idx > cat_idx) / countIf(picked_category), 1) AS selection_after_category_pct,
+ round(100 * countIf(had_selection AND NOT picked_category) / countIf(NOT picked_category), 1) AS selection_without_category_pct
+FROM per_open
+```
+
+### 9. Search latency by group
+
+Legacy only.
+The rebuild does not send `taxonomic filter search latency`.
+
+```sql
+SELECT
+ toString(properties.groupType) AS group_type,
+ round(quantile(0.5)(toFloat(properties.time_to_see_data_ms))) AS p50_ms,
+ round(quantile(0.9)(toFloat(properties.time_to_see_data_ms))) AS p90_ms,
+ round(quantile(0.99)(toFloat(properties.time_to_see_data_ms))) AS p99_ms
+FROM events
+WHERE event = 'taxonomic filter search latency'
+ AND timestamp >= now() - INTERVAL 7 DAY
+GROUP BY group_type
+HAVING count() > 200
+ORDER BY p90_ms DESC
+LIMIT 15
+```
+
+### 10. Fetch failures by group
+
+Both surfaces send fetch failures and `taxonomic_filter_search_query`, but the rebuild sends no `groupType` on its meta-scopes.
+Filter both sides to `legacy-pill` so the per-group ranking stays clean and the rate does not move as rebuild use grows.
+There is no honest rate per group: a list also fails while it feeds Suggested, and then the failure logs its own group but the search logs `suggested_filters`.
+Rank groups by share of failures, and report one overall rate.
+Failures also fire on the first load, when the query is empty, and no search event matches those.
+So the overall rate counts only failures with a non-empty query.
+It is failure events per search query event, not failed searches.
+The failure event has no `inputMode`, so "search query" here covers typed and pasted input alike: on Suggested every list that feeds the tab can fail and send its own event for one search, and short queries that never reach a list still count in the base.
+There is no request ID to count failed searches exactly.
+The share ranking keeps first-load failures, because they show which groups fail.
+The health dashboard divides by timed searches instead, so its rate is higher.
+
+```sql
+WITH f AS (
+ SELECT
+ toString(properties.groupType) AS g,
+ count() AS n,
+ countIf(length(trim(toString(properties.searchQuery))) > 0) AS nonempty_n
+ FROM events
+ WHERE event = 'taxonomic filter fetch failed'
+ AND properties.surface = 'legacy-pill'
+ AND timestamp >= now() - INTERVAL 7 DAY
+ GROUP BY g
+),
+s AS (
+ SELECT count() AS n
+ FROM events
+ WHERE event = 'taxonomic_filter_search_query'
+ AND properties.surface = 'legacy-pill'
+ AND timestamp >= now() - INTERVAL 7 DAY
+)
+SELECT
+ f.g AS group_type,
+ round(100 * f.n / sum(f.n) OVER (), 1) AS share_of_failures_pct,
+ round(100 * (SELECT sum(nonempty_n) FROM f) / (SELECT n FROM s), 2) AS failure_events_per_100_search_queries
+FROM f
+ORDER BY share_of_failures_pct DESC
+LIMIT 15
+```
+
+### 11. Assistive feature funnels
+
+Event match: answered, then suggested, then selected.
+Intent banner: banner shown, then switched.
+Write back the step ratios.
+
+- `event match suggested` carries no query or request ID, so no key counts suggestions exactly.
+ The raw count runs high: a tab switch that reuses a cached answer sends it again.
+ The distinct count per person, session and suggestion list can run high or low: two queries with the same list count once, but pickers with different exclusions turn one answer into several lists.
+ Neither is a bound.
+ Report both as rough estimates, and trust the order of magnitude, not the exact value.
+- The backend sends `event match answered` for every call, even when the model never answered.
+ The query leaves out `outcome` values `unavailable`, `wrong_length` and `only_values`, so the base is real model answers.
+- Selections have no exposure ID to pair with a suggestion, so the selection step compares person-sessions on both sides.
+- Every experiment arm sends `search intent predicted`, but only the `banner` arm can switch.
+ On the banner arm, `shown` can be true when `suggestsSwitch` is false (it seems to lag one prediction), so the query needs both.
+
+```sql
+SELECT
+ round(100 * uniqIf((person_id, $session_id, toString(properties.suggestedEvents)), event = 'taxonomic filter event match suggested')
+ / countIf(event = 'taxonomic filter event match answered'
+ AND toString(properties.outcome) NOT IN ('unavailable', 'wrong_length', 'only_values')), 1) AS match_suggested_per_answer_distinct_pct,
+ round(100 * countIf(event = 'taxonomic filter event match suggested')
+ / countIf(event = 'taxonomic filter event match answered'
+ AND toString(properties.outcome) NOT IN ('unavailable', 'wrong_length', 'only_values')), 1) AS match_suggested_per_answer_raw_pct,
+ round(100 * uniqIf((person_id, $session_id), event = 'taxonomic filter event match selected')
+ / uniqIf((person_id, $session_id), event = 'taxonomic filter event match suggested'), 1) AS sessions_selecting_per_session_suggested_pct,
+ round(100 * countIf(event = 'taxonomic filter search intent switched')
+ / countIf(event = 'taxonomic filter search intent predicted' AND properties.variant = 'banner'
+ AND toString(properties.suggestsSwitch) = 'true' AND toString(properties.shown) = 'true'), 1) AS switched_per_shown_banner_pct
+FROM events
+WHERE event IN ('taxonomic filter event match answered', 'taxonomic filter event match suggested',
+ 'taxonomic filter event match selected', 'taxonomic filter search intent predicted',
+ 'taxonomic filter search intent switched')
+ AND timestamp >= now() - INTERVAL 7 DAY
+```
+
+### 12. Recovery after an empty result
+
+Share of empty results followed by a searched selection in the same person, session and surface within 30 seconds, per surface.
+The surfaces cover different empty states (legacy sends none from Suggested, the rebuild sends them from its meta-scopes), so never pool them.
+Two pickers open at once in one session can still match each other; exact matching would need a picker instance ID.
+This counts every empty result, including repeats while typing, so it reads lower than the health dashboard's recovery tile.
+Compare each against its own history, not each other.
+
+```sql
+WITH empties AS (
+ SELECT person_id, $session_id AS sid, coalesce(toString(properties.surface), '') AS surface, timestamp AS t
+ FROM events
+ WHERE event = 'taxonomic filter empty result'
+ AND timestamp >= now() - INTERVAL 7 DAY
+ AND $session_id IS NOT NULL
+),
+picks AS (
+ SELECT person_id, $session_id AS sid, coalesce(toString(properties.surface), '') AS surface, timestamp AS t
+ FROM events
+ WHERE event = 'taxonomic filter item selected'
+ AND toBool(properties.hadSearchInput)
+ AND timestamp >= now() - INTERVAL 7 DAY
+ AND $session_id IS NOT NULL
+)
+-- ASOF matches only the next pick per empty result, so the join does not grow as empties x picks
+SELECT
+ e.surface AS surface,
+ round(100 * countIf(p.t > e.t AND p.t <= e.t + INTERVAL 30 SECOND) / count(), 1) AS recovered_within_30s_pct
+FROM empties e
+ASOF LEFT JOIN picks p ON e.person_id = p.person_id AND e.sid = p.sid AND e.surface = p.surface AND p.t > e.t
+GROUP BY surface
+ORDER BY surface
+```
+
+### 13. Tab use, docking and empty-result rate
+
+Legacy closes over 90 days, plus the legacy empty-result rate.
+Backs the person properties, standalone Recent and Pinned, docking and empty-result rows in [feature-inventory](feature-inventory.md).
+Two caveats limit what this query can say:
+
+- `groupType` on a close is the tab open at close, and `hadSelection` stays true once any pick happens.
+ A pick on one tab followed by a switch to Person properties counts as a Person properties success, and the reverse is missed.
+ So the per-tab rates are final-tab associations, not exact per-tab conversion.
+- `categoryRailDocked` is the saved preference, not whether a rail showed.
+ It stays on in single-group pickers, where `InfiniteSelectResults` hides the rail.
+ So the docking columns describe the preference, not visible docking.
+
+```sql
+SELECT
+ round(100 * countIf(toBool(properties.hadSelection)) / count(), 1) AS all_tabs_selection_pct,
+ round(100 * countIf(toBool(properties.hadSelection) AND properties.groupType = 'person_properties')
+ / countIf(properties.groupType = 'person_properties'), 1) AS person_properties_selection_pct,
+ round(100 * countIf(properties.groupType = 'recent_filters') / count(), 2) AS closes_on_recent_tab_pct,
+ round(100 * countIf(toBool(properties.hadSelection) AND properties.groupType = 'recent_filters')
+ / countIf(properties.groupType = 'recent_filters'), 1) AS recent_tab_selection_pct,
+ round(100 * countIf(properties.groupType = 'pinned_filters') / count(), 2) AS closes_on_pinned_tab_pct,
+ round(100 * countIf(toBool(properties.categoryRailDocked)) / count(), 1) AS docked_closes_pct,
+ round(100 * countIf(toBool(properties.hadSelection) AND toBool(properties.categoryRailDocked))
+ / countIf(toBool(properties.categoryRailDocked)), 1) AS docked_selection_pct,
+ round(100 * countIf(toBool(properties.hadSelection) AND NOT toBool(properties.categoryRailDocked))
+ / countIf(NOT toBool(properties.categoryRailDocked)), 1) AS undocked_selection_pct,
+ round(100 * (
+ SELECT count() FROM events
+ WHERE event = 'taxonomic filter empty result' AND properties.surface = 'legacy-pill'
+ AND timestamp >= now() - INTERVAL 90 DAY
+ ) / (
+ SELECT count() FROM events
+ WHERE event = 'taxonomic_filter_search_query' AND properties.surface = 'legacy-pill'
+ AND timestamp >= now() - INTERVAL 90 DAY
+ ), 1) AS empty_results_per_100_search_queries
+FROM events
+WHERE event = 'taxonomic filter closed'
+ AND properties.surface = 'legacy-pill'
+ AND timestamp >= now() - INTERVAL 90 DAY
+```
+
+### 14. Which tabs users open
+
+Share of category clicks by tab, over 90 days.
+It is a relative click mix, not an open rate: one open can switch tabs several times, and Suggested, Recent and Pinned clicks are in the base too.
+It shows which tabs people click least, which backs the pseudo-category tabs row in [feature-inventory](feature-inventory.md) as a lead.
+Before you remove a tab, measure distinct opens or users that use it over one window, as step 6 of "Before removing anything" asks.
+
+```sql
+SELECT
+ toString(properties.groupType) AS group_type,
+ round(100 * count() / sum(count()) OVER (), 1) AS share_of_category_clicks_pct
+FROM events
+WHERE event = 'taxonomic filter category selected'
+ AND timestamp >= now() - INTERVAL 90 DAY
+GROUP BY group_type
+ORDER BY share_of_category_clicks_pct DESC
+LIMIT 30
+```
+
+### 15. Users who return to the same tab
+
+Per-user return to a category tab over 90 days.
+Backs the "reopen on the last category used" entry in [contested-decisions](contested-decisions.md).
+Suggested, Recent and Pinned do not count as a category.
+Category clicks carry no open ID, so "again" means on a later day.
+Counting a later session instead raises the first rate by about three points.
+The second rate divides by people who closed the legacy picker, so rebuild-only users are not in its base.
+
+```sql
+WITH tab_days AS (
+ SELECT person_id, toString(properties.groupType) AS group_type, uniqExact(toDate(timestamp)) AS days
+ FROM events
+ WHERE event = 'taxonomic filter category selected'
+ AND properties.groupType NOT IN ('suggested_filters', 'recent_filters', 'pinned_filters')
+ AND timestamp >= now() - INTERVAL 90 DAY
+ GROUP BY person_id, group_type
+),
+switchers AS (
+ SELECT person_id, max(days) >= 2 AS returned
+ FROM tab_days
+ GROUP BY person_id
+)
+SELECT
+ round(100 * countIf(returned) / count(), 1) AS switchers_returning_to_same_tab_pct,
+ round(100 * countIf(returned) / (
+ SELECT uniqExact(person_id) FROM events
+ WHERE event = 'taxonomic filter closed' AND properties.surface = 'legacy-pill'
+ AND timestamp >= now() - INTERVAL 90 DAY
+ ), 1) AS legacy_picker_users_returning_pct
+FROM switchers
+```
+
## Updating the doc
-1. Run each query above via `posthog:execute-sql` against
- project 2 on us.posthog.com.
-2. Convert findings into ratios (drop absolute event and user counts).
-3. Update the tables in `SKILL.md` and bump the "last refreshed" date.
-4. If the qualitative story changed (e.g. `email` is no longer dominant,
- or pinned-items usage grew significantly), revise the prose above the
- tables — not just the numbers. Big changes deserve a heads-up to whoever
- owns the component, since they may affect ongoing roadmap decisions.
+1. Run each metric in the table above with `posthog:data-catalog-metric-run`, and the other queries via the PostHog MCP `posthog:execute-sql` against project 2 on us.posthog.com.
+2. Convert results to ratios.
+ Drop absolute event and user counts.
+3. Update [product-reality](product-reality.md) and the five-line picture in `SKILL.md`, and bump the "last refreshed" date.
+4. If the story changed, not just the numbers, revise the prose and check [failure-modes](failure-modes.md) and [feature-inventory](feature-inventory.md) still hold.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/surfaces-and-mirroring.md b/.agents/skills/modifying-taxonomic-filter/references/surfaces-and-mirroring.md
new file mode 100644
index 000000000000..8c437f6a30e9
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/surfaces-and-mirroring.md
@@ -0,0 +1,76 @@
+# Surfaces and mirroring
+
+There are two live surfaces, and the rebuild is a parallel reimplementation of the legacy data and group layer, not a skin over it.
+A behavior change usually has to land in both, or the two arms diverge.
+
+## Two surfaces
+
+A feature flag and a per-user toggle select between them in the shared wrappers.
+The flag `TAXONOMIC_FILTER_MENU_REBUILD` makes the rebuild available.
+The user's saved choice in `taxonomicMenuPreferenceLogic.useNewMenu` (the "Switch to the classic filter" toggle) then decides which one renders.
+It defaults to on, so a flag-on user gets the rebuild until they switch back.
+A bug report that doesn't reproduce locally is almost always a surface mismatch.
+Confirm which surface the reporter is on first: most `taxonomic filter *` events carry `surface` (see [telemetry-contract](telemetry-contract.md) for the exceptions).
+
+| Surface | When it renders | What renders |
+| -------------- | ----------------------------------------- | --------------------------------------------- |
+| `legacy-pill` | flag off, or flag on and `useNewMenu` off | classic picker with a category dropdown |
+| `rebuild-menu` | flag on and `useNewMenu` on | ground-up rewrite in `menu/` over `headless/` |
+
+- **legacy-pill** is the classic picker (`taxonomicFilterLogic.tsx` + `InfiniteList`) with a suffix category dropdown.
+ A person can pin the category rail from that dropdown.
+- **rebuild-menu** is a fresh implementation: the `menu/` dropdown and combobox UI on top of `headless/` (a hooks-based filter panel).
+ It does **not** route through `taxonomicFilterLogic` or `infiniteListLogic`.
+ It has its own group definitions, fetch, pagination and ordering.
+ See `headless/UX_SPEC.md` for its design source of truth.
+ Some customers still see it, so treat it as live.
+
+Two **shared consumer wrappers** choose a surface: `TaxonomicPopover.tsx` and `PropertyFilters/components/TaxonomicPropertyFilter.tsx`.
+Both check `TAXONOMIC_FILTER_MENU_REBUILD` and `useNewMenu`, then render `<TaxonomicFilterMenu>` or the legacy `<TaxonomicFilter>`.
+
+Some call sites mount the rebuild directly and skip both checks.
+Today that is Error Tracking's issue filters (`products/error_tracking/frontend/components/IssueFilters/FilterGroup.tsx`), which mounts `TaxonomicFilterHeadless.Root` and `TaxonomicFilterMenu`.
+Every user there is on the rebuild, whatever the flag or toggle says.
+Find others with a search for direct imports of `menu/TaxonomicFilterMenu` or `headless` outside `TaxonomicFilter/` and `TaxonomicPopover/`.
+
+A call site reaching one of those wrappers can still land on the legacy path.
+`TaxonomicPopover` renders the rebuild only when `newMenuSupportsCallSite` holds (`!allowClear && closeOnChange && ref == null`), because the rebuilt menu can't honor those three capabilities.
+So "does this reach the rebuild?" depends on the wrapper and the props that call site passes.
+`ActionFilterRow` goes through `TaxonomicPopover` and passes none of the three, so it does reach the rebuild.
+`TaxonomicPropertyFilter` has a legacy branch too: without `disablePopover`, a new or empty row, or a HogQL row, sets `showInitialSearchInline` and renders the legacy picker inline, whatever the flag and toggle say.
+With `disablePopover`, that branch is skipped and the flag and toggle decide.
+A group row (`nestedGroup`) opens no picker at all; a leaf row inside a group follows the same rules as any other row.
+Without `disablePopover`, only an existing, non-HogQL row reaches the flag and toggle check.
+
+Many call sites skip the wrappers and mount the legacy picker directly, so they always render legacy.
+Examples are `ColumnConfigurator.tsx` (inline `<TaxonomicFilter>`), `UniversalFilters.tsx` (`PureTaxonomicFilter`) and `TaxonomicBreakdownPopover.tsx`.
+Search the repo for direct `<TaxonomicFilter` and `PureTaxonomicFilter` uses to find them all before you decide which surfaces a change touches.
+
+**Touching tab or group rendering means testing both surfaces.**
+
+## Mirroring changes
+
+The same concern lives in two files.
+There is **no lint rule or test** enforcing parity; the only guard is "Mirrors the legacy…" comments.
+When you change one, change the other, or tell the reviewer you couldn't.
+
+| Concern | Legacy | Rebuild |
+| -------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
+| Group definitions (endpoint, excluded props, group meta) | `taxonomicFilterLogic.tsx` `taxonomicGroups` selector | `utils/buildTaxonomicGroups.tsx` |
+| Group ordering + SuggestedFilters injection | `taxonomicFilterLogic.tsx` `taxonomicGroupTypes` selector | `hooks/useTaxonomicFilter.ts` `resolveTaxonomicGroupTypes` |
+| Per-tab fetch / pagination / min-query-length | `infiniteListLogic.ts` | `hooks/useGroupList.ts` + `useTaxonomicResource.ts` + `fetchTaxonomicListPage.ts` |
+| Fetch error state | `InfiniteList.tsx` `InfiniteListErrorState` + `infiniteListLogic.ts` | `menu/Combobox.tsx` error block + `hooks/useGroupList.ts` `showErrorState` |
+| Data-warehouse config flow | inline in `InfiniteList.tsx` | `menu/DwhFlow.tsx` |
+| `taxonomic filter item selected` / `closed` telemetry | `taxonomicFilterLogic.tsx` | `menu/TaxonomicFilterMenu.tsx` |
+| Standalone Recent and Pinned entries | `taxonomicFilterLogic.tsx` `taxonomicGroupTypes` selector (`recent_filters`, `pinned_filters`) | `menu/TaxonomicFilterMenu.tsx` (menu entries) + `menu/Combobox.tsx` (`recent` and `pinned` scopes) |
+| New `TaxonomicFilterGroupType` enum value | `types.ts` (shared), then add group config in **both** rows above | |
+| Logic-backed group data (Actions, Dashboards, …) | already in kea | also register in `hooks/useTaxonomicLocalOverrides.ts` |
+
+**Shared, change once:** `types.ts` (the enum), `utils/promoteProperties.ts` (`PROMOTED_PROPERTIES_BY_SEARCH_TERM`), `recentTaxonomicFiltersLogic.ts` and `taxonomicFilterPinnedPropertiesLogic.ts`.
+The rebuild reads recents and pins through these via a bridge; it doesn't fork them.
+
+`redistributeTopMatches` is legacy-only: it lives in `taxonomicFilterLogic.tsx` and the rebuild never calls it.
+
+Suggested ordering is shared behavior: both surfaces drop SuggestedFilters when there is one substantive group, and lead with it when there are two or more (legacy `resolveSuggestedFiltersGroup` in `taxonomicFilterLogic.tsx`, rebuild `resolveTaxonomicGroupTypes` in `hooks/useTaxonomicFilter.ts`).
+Keep the two in parity when you change it.
+Where a real divergence exists, it is documented next to the code; preserve those, and don't "fix" them into parity.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/telemetry-contract.md b/.agents/skills/modifying-taxonomic-filter/references/telemetry-contract.md
new file mode 100644
index 000000000000..847c86a29f02
--- /dev/null
+++ b/.agents/skills/modifying-taxonomic-filter/references/telemetry-contract.md
@@ -0,0 +1,122 @@
+# Telemetry contract
+
+Dashboards, experiments and replay scanners read these events.
+Treat property shapes as a public API.
+`frontend/src/lib/components/TaxonomicFilter/telemetryContract.test.ts` reads every `taxonomic filter` capture call and fails when an event or property is missing here, or when an event listed here is no longer sent.
+When it fails, update this file in the same PR.
+
+- **Adding** a property: fine.
+- **Removing** a dead one: fine, once nothing reads it.
+- **Renaming or repurposing silently** is the worst case.
+ Dashboards keep working and start lying.
+
+The legacy stamp `legacy-pill` comes from `legacyTaxonomicSurface()` in `taxonomicFilterSurface.ts`.
+The rebuild stamps `rebuild-menu` from `TAXONOMIC_FILTER_SURFACE` in `menu/types.ts`.
+Only the events marked "with `surface`" below carry it.
+Older data also has `legacy-control` and empty values.
+A filter such as `surface = 'legacy-pill'` drops every row without the property, so check the list before you filter.
+
+## `groupType` vs `sourceGroupType`
+
+On `taxonomic filter item selected`:
+
+- `groupType` is the tab that was active when the user picked.
+- `sourceGroupType` is the group the item belongs to.
+
+A pick from Suggested has `groupType = suggested_filters` and a real `sourceGroupType`.
+To judge whether a group's items are used, count `sourceGroupType`.
+To judge whether a tab is used, count `groupType`.
+Mixing them up makes reachable groups look unused.
+
+This holds for legacy only.
+The rebuild sends no `groupType` for its `all`, `recent` and `pinned` scopes (`telemetryGroupType` in `menu/Combobox.tsx`), so its data cannot tell those three apart.
+In a query over both surfaces, label an empty `groupType` from `rebuild-menu` as an unknown meta-scope.
+Do not fold it into Suggested or All, or treat it as Recent: the standalone Recent and Pinned picks are in there too.
+Telling the scopes apart needs new telemetry.
+HogQL and data warehouse commits (`menu/HogQLEditor.tsx`, `menu/DwhFlow.tsx`) also send no `groupType`, because they commit without a selection context.
+They still send `sourceGroupType`, so split those rows out by `sourceGroupType` before you label the rest as a meta-scope.
+
+## Shared events (both surfaces)
+
+Keep these comparable across arms.
+Add a property to both emitters or neither.
+All carry `surface` on both surfaces, except `include stale toggled`, which carries it on the rebuild only.
+
+- `taxonomic filter closed`: `dwellMs`, `hadSelection`, `categoryRailDocked`.
+ Legacy also sends `groupType`; the rebuild omits it because there is no single active tab at close.
+ Legacy sends it only when `hadInteraction` is true.
+ The rebuild sends it on every close, so their selection rates have different denominators.
+- `taxonomic filter item selected`: `groupType`, `sourceGroupType`, `wasFromRecents`, `wasFromPinnedList`, `wasQuickFilter`, `hadSearchInput`, `position`, `query`, `wasStale`, `wasUrlContainsShortcut`.
+ Legacy sends `wasUrlContainsShortcut` only on a quick filter, with `filterName`, `propertyKey`, `operator`, `filterValue`, `propertyFilterType` and `eventName`.
+ The rebuild always sends `wasUrlContainsShortcut` and none of the others.
+- `taxonomic_filter_search_query`: `searchQuery`, `groupType`, `inputMode`, `pastedFraction`, `excludeStale`.
+- `taxonomic filter empty result`: `groupType`, `searchQuery`.
+ Legacy sends it only from a remote list on the active tab.
+ Suggested is a local list, so its empty state sends nothing.
+ Add coverage there before you measure a change to the Suggested empty state.
+- `taxonomic filter fetch failed`: `groupType`, `searchQuery`, and on legacy `forbidden` (true when the request was refused with a 403).
+ Each surface sends it once per group or scope and query while the request keeps failing.
+ Legacy has also sent it on first-load failures since 2026-09-13, so legacy rates from before then are not comparable.
+ The rebuild sends no `groupType` on its `all`, `recent` and `pinned` scopes.
+- `taxonomic filter include stale toggled`: `includeStaleEvents`, `groupType`, `searchQuery`.
+ Only the rebuild sends `surface` on this one.
+
+## Legacy only, with `surface`
+
+- `taxonomic filter search latency`: `groupType`, `searchQuery`, `resultCount`, `time_to_see_data_ms`.
+ The rebuild does not send it yet (see `hooks/useGroupList.ts`).
+- `taxonomic filter search intent predicted`: `query`, `activeTab`, `predictedGroupType`, `confidence`, `isConfident`, `suggestsSwitch`, `wouldPromote`, `promptVersion`, `source`, `variant`, `inTime`, `shown`.
+ The banner funnel in [refreshing-product-reality](refreshing-product-reality.md) reads `variant` and `shown`.
+- `taxonomic filter search intent switched`: `fromGroupType`, `toGroupType`.
+- `taxonomic filter event match eligible`: `tab`, `variant`.
+ Sent once per project and query when the search qualifies for event match. The experiment's exposure reads it.
+- `taxonomic filter event match hint shown`: `tab`, `hint`, and `unsentEvents` when `hint` is `unsent`.
+- `taxonomic filter event match suggested`: `suggestedEvents`, `tab`.
+- `taxonomic filter event match selected`: `eventName`, `position`, `tab`.
+
+Read the event match events as a funnel: answered, then suggested, then selected.
+
+## Legacy only, without `surface`
+
+- `taxonomic filter add filter clicked`: `eventName`.
+ Fires only when a property filter row opens with no valid filter yet.
+ Most opens do not send it, so do not use it to split sessions into opens.
+ Split after each legacy `taxonomic filter closed` instead.
+- `taxonomic filter category selected`: `groupType`, `eventName`.
+- `taxonomic filter category dropdown opened`: `variant`.
+- `taxonomic filter category rail toggled`: `docked`.
+- `taxonomic filter event match answered`: `outcome`.
+ Emitted server side.
+
+## Both surfaces, without `surface`
+
+These come from the shared `taxonomicFilterPinnedPropertiesLogic.ts`, which both surfaces call.
+Nothing on them says which surface sent them.
+
+- `taxonomic filter pin toggled`: `groupType`, `value`, `pinned`.
+ A rebuild pin click sends `taxonomic filter menu pin toggled` and then this one too, so do not add the two together.
+- `taxonomic filter default pins seeded`: `values`.
+
+## Rebuild only, without `surface`
+
+Every event here comes from the rebuild, so no `surface` filter is needed.
+Do not add `surface = 'rebuild-menu'` to a query on them: it returns no rows.
+
+- `taxonomic filter menu opened`: `openedTo`, `hadSelection`, `triggerLabel`, `msSinceLastClose`, `reopenedQuickly`.
+- `taxonomic filter menu drilled`: `fromState`, `toState`.
+- `taxonomic filter menu closed`: `dwellMs`, `hadCommit`, `lastState`.
+- `taxonomic filter menu option clicked`: `option`.
+- `taxonomic filter menu item selected`: `groupType`, `hadSearchInput`, `query`, `hadExtras`, `fromState`, `msSinceOpen`.
+- `taxonomic filter menu category changed`: `fromChip`, `toChip`, `via`, and `direction` when `via` is `tab`.
+- `taxonomic filter menu pin toggled`: `groupType`, `pinned`.
+
+## Toggle, either surface, without `surface`
+
+- `taxonomic filter menu preference changed`: `useNewMenu`.
+ It comes from the classic/new toggle and fires on either surface for users who have the rebuild flag.
+
+## Before changing telemetry
+
+1. Search dashboards and insights for the event and property (`system.insights` via the PostHog MCP).
+2. Check the replay scanners' prompts if they mention the behavior.
+3. Update [refreshing-product-reality](refreshing-product-reality.md) if a query uses it.
diff --git a/.agents/skills/modifying-taxonomic-filter/references/testing-patterns.md b/.agents/skills/modifying-taxonomic-filter/references/testing-patterns.md
index c7a2f3cede55..177bb5b64b6e 100644
--- a/.agents/skills/modifying-taxonomic-filter/references/testing-patterns.md
+++ b/.agents/skills/modifying-taxonomic-filter/references/testing-patterns.md
@@ -76,7 +76,7 @@ for (const groupType of taxonomicGroupTypes) {
## Don't delete the property-promotion test
`email` and `url` searches must promote `$email` and `$current_url` to
-position 0 (see Product reality in `SKILL.md`):
+position 0 (see [product-reality](product-reality.md)):
```tsx
await userEvent.type(searchField, 'url')
diff --git a/frontend/src/lib/components/TaxonomicFilter/telemetryContract.test.ts b/frontend/src/lib/components/TaxonomicFilter/telemetryContract.test.ts
new file mode 100644
index 000000000000..814207bf3be3
--- /dev/null
+++ b/frontend/src/lib/components/TaxonomicFilter/telemetryContract.test.ts
@@ -0,0 +1,128 @@
+import fs from 'fs'
+import path from 'path'
+
+const COMPONENTS_DIR = path.resolve(__dirname, '..')
+const SOURCE_ROOTS = [
+ path.join(COMPONENTS_DIR, 'TaxonomicFilter'),
+ path.join(COMPONENTS_DIR, 'TaxonomicPopover'),
+ path.join(COMPONENTS_DIR, 'PropertyFilters/components/taxonomicPropertyFilterLogic.ts'),
+ path.resolve(COMPONENTS_DIR, '../utils/eventUsageLogic.ts'),
+]
+const CONTRACT_PATH = path.resolve(
+ __dirname,
+ '../../../../../.agents/skills/modifying-taxonomic-filter/references/telemetry-contract.md'
+)
+// Each section of the contract states whether its events carry `surface`, so it is not listed per event.
+const IMPLIED_PROPERTIES = new Set(['surface'])
+// Sent from the backend, so no frontend capture call exists for it.
+const SERVER_SIDE_EVENTS = new Set(['taxonomic filter event match answered'])
+
+function sourceFiles(root: string): string[] {
+ if (fs.statSync(root).isFile()) {
+ return [root]
+ }
+ return fs.readdirSync(root, { withFileTypes: true }).flatMap((entry) => {
+ const full = path.join(root, entry.name)
+ if (entry.isDirectory()) {
+ return sourceFiles(full)
+ }
+ return /\.tsx?$/.test(entry.name) && !/\.(test|stories)\.tsx?$/.test(entry.name) ? [full] : []
+ })
+}
+
+function matchingBrace(text: string, open: number): number {
+ let depth = 0
+ for (let i = open; i < text.length; i++) {
+ if (text[i] === '{') {
+ depth++
+ } else if (text[i] === '}' && --depth === 0) {
+ return i
+ }
+ }
+ return -1
+}
+
+function objectKeys(body: string): string[] {
+ const withoutComments = body.replace(/\/\/[^\n]*/g, '')
+ const entries: string[] = []
+ let depth = 0
+ let current = ''
+ for (const char of withoutComments) {
+ if ('{[('.includes(char)) {
+ depth++
+ } else if ('}])'.includes(char)) {
+ depth--
+ }
+ if (char === ',' && depth === 0) {
+ entries.push(current)
+ current = ''
+ } else {
+ current += char
+ }
+ }
+ entries.push(current)
+ return entries.flatMap((raw) => {
+ const entry = raw.trim()
+ if (entry.startsWith('...')) {
+ const open = entry.indexOf('{')
+ return open === -1 ? [] : objectKeys(entry.slice(open + 1, matchingBrace(entry, open)))
+ }
+ const key = entry.match(/^['"]?([\w$]+)['"]?\s*(?::|$)/)
+ return key ? [key[1]] : []
+ })
+}
+
+function capturedEvents(): Map<string, Set<string>> {
+ const events = new Map<string, Set<string>>()
+ for (const file of SOURCE_ROOTS.flatMap(sourceFiles)) {
+ const text = fs.readFileSync(file, 'utf8')
+ for (const match of text.matchAll(/posthog\.capture\(\s*['"](taxonomic[^'"]+)['"]\s*(,\s*\{)?/g)) {
+ const keys = events.get(match[1]) ?? new Set<string>()
+ if (match[2]) {
+ const open = match.index + match[0].length - 1
+ objectKeys(text.slice(open + 1, matchingBrace(text, open))).forEach((key) => keys.add(key))
+ }
+ events.set(match[1], keys)
+ }
+ }
+ return events
+}
+
+function documentedEvents(): Map<string, string> {
+ const documented = new Map<string, string>()
+ let current: string | null = null
+ for (const line of fs.readFileSync(CONTRACT_PATH, 'utf8').split('\n')) {
+ const bullet = line.match(/^- `(taxonomic[^`]+)`/)
+ if (bullet) {
+ current = bullet[1]
+ documented.set(current, (documented.get(current) ?? '') + line)
+ } else if (current && line.startsWith(' ')) {
+ documented.set(current, documented.get(current) + line)
+ } else {
+ current = null
+ }
+ }
+ return documented
+}
+
+const captured = capturedEvents()
+const documented = documentedEvents()
+
+describe('taxonomic filter telemetry contract', () => {
+ test.each([...captured.entries()].map(([event, keys]) => [event, [...keys]]))(
+ '%s is listed in telemetry-contract.md with every property it sends',
+ (event, keys) => {
+ const entry = documented.get(event as string)
+ expect(entry).not.toBeUndefined()
+ const missing = (keys as string[]).filter(
+ (key) => !IMPLIED_PROPERTIES.has(key) && !entry?.includes(`\`${key}\``)
+ )
+ expect(missing).toEqual([])
+ }
+ )
+
+ it('lists no event that the frontend no longer sends', () => {
+ const stale = [...documented.keys()].filter((event) => !captured.has(event) && !SERVER_SIDE_EVENTS.has(event))
+ expect(stale).toEqual([])
+ })
+})