:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(experiments): improving creation skills (metric templates + experiment-setup-context) (#104059)
Marcel Poelker9b222215cf46
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yamlindex 44ad184cee97..b47f8614b2af 100644--- a/products/experiments/mcp/tools.yaml+++ b/products/experiments/mcp/tools.yaml@@ -246,11 +246,16 @@ tools:the configuring-experiment-analytics skill formetric guidance.+ 4. If experiment-setup-context is available, call it+ first and use its facts to choose bucketing,+ exposure and metrics.+Creates a new experiment in draft status (ignore the "type" param, since no-code/toolbar experiments must becreated in the PostHog UI). Requires name and feature_flag_key. Feature flag is auto-created — do not create- one separately. Defaults: 50/50 control/test, 100% rollout, Bayesian stats. Launch the experiment with the- launch tool when ready.+ one separately, except for device-id bucketing, which this tool cannot set: create the flag first with+ `create-feature-flag`. Defaults: 50/50 control/test, 100% rollout, the team's default stats method. Launch+ the experiment with the launch tool when ready.include_params:- name- descriptiondiff --git a/products/experiments/skills/configuring-experiment-analytics/SKILL.md b/products/experiments/skills/configuring-experiment-analytics/SKILL.mdindex 2bf36a9bc559..cc364586b554 100644--- a/products/experiments/skills/configuring-experiment-analytics/SKILL.md+++ b/products/experiments/skills/configuring-experiment-analytics/SKILL.md@@ -148,6 +148,8 @@ RIGHT: *calls read-data-schema* → "Here are the events in your project### Step 3: Choose metric type+Start from a template in `references/metric-templates.md`: it maps common requests ("more revenue", "people come back") to a metric type and the defaults to set with it (window units, winsorization, goal).+There are four metric types. Each has `kind: "ExperimentMetric"`:| metric_type | When to use | Required fields |diff --git a/products/experiments/skills/configuring-experiment-analytics/references/metric-templates.md b/products/experiments/skills/configuring-experiment-analytics/references/metric-templates.mdnew file mode 100644index 000000000000..6b8f326528fc--- /dev/null+++ b/products/experiments/skills/configuring-experiment-analytics/references/metric-templates.md@@ -0,0 +1,31 @@+# Metric templates++Most metric requests match one of these shapes. Pick the template, fill in the project's events (confirmed with `read-data-schema`), and set its defaults.+Check for a shared metric first (Step 1 in `SKILL.md`): a matching shared metric beats any template.++Every conversion window needs a unit: set `conversion_window` and `conversion_window_unit` together, or neither.+A window without a unit is ignored and the metric counts events until the experiment ends.++| Template | Use when the user asks | Shape | Defaults to set | Say in the summary |+| ------------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| Conversion | "more people do X" | `funnel`, one step (exposure is step 0) | `goal: "increase"`. A window with a unit when X usually happens within a known delay (a signup within a day) | X must be captured for the exposed person, with the same identity |+| Journey | "more people get from A through B to C" | `funnel`, 2 to 4 ordered steps | Same as conversion | Numbers won't match a product analytics funnel: exposure comes first and test accounts are removed |+| Count per user | "people do X more often" | `mean`, `math: "total"` | `upper_bound_percentile: 0.99` | Heavy users can dominate the mean; the upper bound caps them |+| Revenue per user | "more revenue", "people spend more" | `mean`, `math: "sum"`, `math_property` = the revenue property | `upper_bound_percentile: 0.99` | A few large orders make revenue noisy. If revenue arrives on several events or properties, the metric must cover all of them. Server-side purchase events need the same identity as the exposure |+| Average value | "X gets faster", "sessions get longer" | `mean`, `math: "avg"` with `math_property` = the value property | `goal: "decrease"` when lower is better (latency, load time), otherwise `"increase"` | Server-side events have no session |+| Unique-user rate | "a larger share of users do X" relative to another group | `ratio`, `math: "dau"` (unique users) on both numerator and denominator | None | A few heavy users can move a total-over-total ratio; unique users avoids that |+| Average order value | "bigger orders" | `ratio`, numerator `math: "sum"` of the revenue property, denominator `math: "total"` of the same event | `numerator_outlier_handling: {"upper_bound_percentile": 0.99}` (ratio metrics take no top-level `upper_bound_percentile`) | Read it together with conversion and revenue per user: fewer, larger orders can raise it while revenue falls |+| Return rate | "people come back", "retention" | `retention`, `start_handling: "first_seen"`, `retention_window_start: 1`, `retention_window_end: 7`, `retention_window_unit: "day"` | Completed window only (see below) | Users exposed near the end have had less time to return and pull the rate down |+| Trial to paid | "more trials convert to paid" | `funnel` with a fixed window | A window with its unit, longer than the trial: it starts at exposure, not at the trial start, so it must cover the time to start the trial plus the trial. Completed window only (see below) | One window must cover both the trial start and the payment |++## Completed window only++The experiment setting "Require completed conversion or retention window" (`only_count_matured_users`) counts only people whose whole window has passed.+Creation turns it on when the team's default is on (`team_defaults.only_count_matured_users` in `experiment-setup-context`).+The agent cannot set it: `experiment-create` and `experiment-update` don't expose it.+For return rate and trial to paid, when the team default is off, recommend it in the summary and tell the user to turn it on in the experiment's Settings tab.++## Which template is primary++The primary metric decides the ship call, so it should be the most frequent event that still expresses the hypothesis.+If the requested event is rare on this page (the running time comes out at months), make it secondary and propose an earlier, more frequent event as primary.diff --git a/products/experiments/skills/configuring-experiment-rollout/SKILL.md b/products/experiments/skills/configuring-experiment-rollout/SKILL.mdindex 38fdb0094ce6..8677158a7fd3 100644--- a/products/experiments/skills/configuring-experiment-rollout/SKILL.md+++ b/products/experiments/skills/configuring-experiment-rollout/SKILL.md@@ -76,8 +76,7 @@ Both controls live inside `feature_flag.filters`:]},"groups": [{ "properties": [], "rollout_percentage": 100 }]- },- "ensure_experience_continuity": false+ }}}```@@ -164,16 +163,47 @@ See `configuring-experiment-analytics` for how to set the multivariate handling.as part of the same operation (creation or update) — do not leave the user with an uneven splitunder default handling without an explicit, informed decision.-## Persist flag across authentication steps+## Bucketing and persistence across login-This option (`ensure_experience_continuity` on the feature flag) is only relevant when:+By default a person's variant follows their distinct ID. When the same person sees the flag before and after they are identified (usually at login), their distinct ID changes, and so can their variant.+Choose at creation; never change bucketing or persistence on a live flag. In this order:-- The feature flag is shown to **both** logged-out AND logged-in users-- You need the same variant assignment before and after login+1. **Page seen mostly by one kind of visitor** (almost all anonymous, or almost all identified): keep user-id bucketing and leave `ensure_experience_continuity` out, so the team's persistence default applies.+2. **Page crosses identification, and every flag call carries a device ID**: use device-id bucketing (recipe below). A flag call without a device ID gets no variant, so a server SDK must forward the browser's device ID. Local evaluation works when it does. The web SDK sends the device ID on flag requests from posthog-js 1.307.1; check the version, because an older one puts a device ID on events but not on flag requests.+3. **Page crosses identification, and no SDK evaluates the flag locally**: persist the flag (`ensure_experience_continuity: true`). Persistence needs person profiles for anonymous users, no bootstrapping, and `$anon_distinct_id` on server flag calls. Learn more: https://posthog.com/docs/feature-flags/creating-feature-flags#persisting-feature-flags-across-authentication-steps+4. **Otherwise**: keep user-id bucketing and tell the user what would unlock the other options (a device ID on every flag call, or no local evaluation).-This is not compatible with all setups. Learn more: https://posthog.com/docs/feature-flags/creating-feature-flags#persisting-feature-flags-across-authentication-steps+When `ensure_experience_continuity` is omitted, `experiment-create` applies the team's persistence default. Set it to `false` only when that default is `true` and local evaluation rules persistence out. The device-id recipe needs no such step: `create-feature-flag` leaves persistence off unless you set it, and `experiment-create` rejects a `feature_flag` object for a flag that already exists. Device-id bucketing and persistence can't be combined.-Only mention this to the user if their use case involves pre/post-authentication experiences.+### Device-id bucketing recipe++`experiment-create` cannot set bucketing, so create the flag first, then link it:++1. Call `create-feature-flag` with the experiment's key, `bucketing_identifier: "device_id"`, and `active: false` so no one gets a variant before launch (a new flag is active by default):++ ```json+ {+ "key": "kebab-case-key",+ "name": "Experiment name",+ "active": false,+ "bucketing_identifier": "device_id",+ "filters": {+ "groups": [{ "properties": [], "rollout_percentage": 100 }],+ "multivariate": {+ "variants": [+ { "key": "control", "rollout_percentage": 50 },+ { "key": "test", "rollout_percentage": 50 }+ ]+ }+ }+ }+ ```++ `filters.groups` is required: a flag without a group is rejected.++2. Call `experiment-create` with that `feature_flag_key` and no `feature_flag` object. The experiment links the flag as it is, and launching the experiment turns the flag on.++`experiment-setup-context` reports the facts these rules need (the page's share of unidentified visitors, and per SDK the device-ID and local-evaluation shares). `creating-experiments` (`references/setup-decisions.md`) applies them.## Resolving experimentsdiff --git a/products/experiments/skills/creating-experiments/SKILL.md b/products/experiments/skills/creating-experiments/SKILL.mdindex db2c1befad62..b25bff45611c 100644--- a/products/experiments/skills/creating-experiments/SKILL.md+++ b/products/experiments/skills/creating-experiments/SKILL.md@@ -1,16 +1,32 @@---name: creating-experiments-description: "Guides agents through the 3-step experiment creation flow: defining the hypothesis, configuring rollout, and setting up analytics. Delegates rollout decisions to configuring-experiment-rollout and metric setup to configuring-experiment-analytics.\nTRIGGER when: user asks to create a new experiment or A/B test, OR when you are about to call experiment-create.\nDO NOT TRIGGER when: user is updating an existing experiment, managing lifecycle, or only browsing experiments."+description: "Guides agents through experiment creation: reading the project's setup with experiment-setup-context, defining the hypothesis, configuring rollout and bucketing, setting up analytics and running time, and reporting which choices are guesses. Delegates rollout decisions to configuring-experiment-rollout and metric setup to configuring-experiment-analytics.\nTRIGGER when: user asks to create a new experiment or A/B test, OR when you are about to call experiment-create.\nDO NOT TRIGGER when: user is updating an existing experiment, managing lifecycle, or only browsing experiments."---# Creating experiments-This skill walks through the 3-step flow for creating a new A/B test experiment.+This skill walks through creating a new A/B test experiment: read the project, then the 3-step flow, then report the draft.## Core principle: draft first, iterate on detailsCreate the experiment as a draft quickly, then iterate on metrics and configuration.The user gets a tangible draft immediately and can refine it.+Choose settings from the project's facts rather than asking, and say which choices are guesses.++## Step 0: Read the project++The right bucketing, metric and running time depend on the project: who sees the page, which SDKs evaluate the flag, how often the metric event happens.+Read that before configuring anything.++1. From the request, infer the **target** (the event that marks someone reaching the change, usually `$pageview` plus a URL fragment for a page) and a **candidate metric event**.+ Confirm both exist with `read-data-schema`. Don't ask the user for event names you can find.+2. If the `experiment-setup-context` tool is available, call it once with `target_event`, `target_url_contains` (for a page) and `metric_event`.+ If it is not available, continue without it and treat every choice below as a best guess. Never call a tool you can't see.+3. Apply [references/setup-decisions.md](references/setup-decisions.md) to the result. It maps each fact to a choice (bucketing, where the flag is evaluated, exposure, primary metric, running time, precedent) and to a tier for the summary.+4. Carry those choices into steps 1 to 3.++Ask the user only when a choice is "not decided" and the user is in the conversation.+If the user said they are away, or asked for a draft without questions, decide with the defaults and list the open points in the report.## The 3-step creation flow@@ -20,8 +36,8 @@ Gather these before calling `experiment-create`:- **Experiment name** — descriptive, inferred from context when possible- **Hypothesis** — what you expect to happen (goes in `description`)-- **Feature flag key** — kebab-case. Ask if they want a new flag or to reuse an existing one.- The flag is auto-created — do NOT create one separately.+- **Feature flag key** — kebab-case. Infer a new key unless the user names an existing flag.+ The flag is auto-created — do NOT create one separately. The one exception is device-id bucketing, which `experiment-create` cannot set (see the recipe in `configuring-experiment-rollout`).- **Type** — leave empty (will internally default to `"product"`. The `"web"` value is reserved for no-code experiments configured visually with the PostHogtoolbar in a browser; it cannot be meaningfully driven via MCP. If a user asks for ano-code/toolbar experiment, point them to the PostHog UI instead of creating one here.)@@ -38,7 +54,7 @@ Key decision points (covered in detail by `configuring-experiment-rollout`):- Variant split (how many variants, what percentage each)- Overall rollout percentage (what % of all users enter the experiment)-- Whether to persist the flag across authentication steps+- Bucketing and whether to persist the flag across authentication steps — decided from the project's facts in step 0If the user doesn't mention rollout specifics, use defaults: 50/50 control/test, 100% rollout.@@ -52,7 +68,9 @@ don't duplicate a metric the project already has set up.afterwards via `experiment-update`. This keeps the creation call lightweight.When the user specifies metrics upfront, acknowledge them and add them immediately after creation.-When they don't, create the draft and then guide them through metric setup as a follow-up.+When they don't, infer the primary metric from the hypothesis (step 0) and add it after creation; say it was inferred.++If step 0 produced a running-time estimate, pass it to `experiment-create` as `running_time_calculation` so the plan is stored on the experiment.## How to create@@ -72,8 +90,7 @@ Call `experiment-create` with:]},"groups": [{ "properties": [], "rollout_percentage": 100 }]- },- "ensure_experience_continuity": false+ }}}```@@ -88,18 +105,25 @@ Key details:- Minimum 2, maximum 20 variants. No specific variant key is required — the analysis baseline defaults to the variant keyed `"control"` when present, else the first variant (override with `stats_config.baseline_variant_key`). Convention: key the baseline `"control"` unless the user asks for specific keys.- `filters.groups[0].rollout_percentage` defaults to 100 if omitted.-- `ensure_experience_continuity` persists a user's variant across authentication steps; leave it `false` unless the flag is shown to both logged-out and logged-in users (see `configuring-experiment-rollout`).-- Stats default to Bayesian. Only set `stats_config` if the user requests Frequentist.+- Bucketing and `ensure_experience_continuity` come from step 0. Keep user-id bucketing unless the page crosses identification. Only then, in this order: device-id bucketing when every flag call carries a device ID, else persistence when no SDK evaluates the flag locally, else user-id bucketing. Leave `ensure_experience_continuity` out unless you are choosing persistence: when omitted, the team's persistence default applies.+- Stats follow the team's defaults (method, confidence level). Only set `stats_config` if the user asks for a different method.## After creation-1. **Always show the experiment URL.** The `experiment-create` response includes `_posthogUrl` — always display this link so the user can view and configure the experiment in the UI.+1. **Report the draft in three groups**, so the user can review it quickly:+ - **Set with confidence**: the choice and the fact behind it ("linked the shared metric 'Signups': it counts the signup event per person, as you asked").+ - **Best guess, please check**: the choice, the fact, and what would change it ("user-id bucketing: 94% of visitors are not identified; switch to device id if identified users also see this page").+ - **Not decided**: what is missing and how to decide it ("the flag is also evaluated on your server with local evaluation; check the server and browser use the same distinct ID").++ Also say what you could not read: a missing tool, or a section whose status was not `ok`.++2. **Always show the experiment URL.** The `experiment-create` response includes `_posthogUrl` — always display this link so the user can view and configure the experiment in the UI.-2. **Remind the user to implement the feature flag in code.** Link to the experiment page and say "implement the flag as shown here" — the experiment detail page shows implementation snippets for the user's SDK.+3. **Remind the user to implement the feature flag in code.** Link to the experiment page and say "implement the flag as shown here" — the experiment detail page shows implementation snippets for the user's SDK.-3. **Guide through metrics** if not yet configured — load the `configuring-experiment-analytics` skill.+4. **Guide through metrics** if not yet configured — load the `configuring-experiment-analytics` skill.-4. **Launch** when ready — use the `experiment-launch` tool.+5. **Launch only when the user asks for it** — creation ends at a draft. A launch turns the feature flag on for real users, so never call `experiment-launch` unprompted.## Related skillsdiff --git a/products/experiments/skills/creating-experiments/references/setup-decisions.md b/products/experiments/skills/creating-experiments/references/setup-decisions.mdnew file mode 100644index 000000000000..d3003fbfff09--- /dev/null+++ b/products/experiments/skills/creating-experiments/references/setup-decisions.md@@ -0,0 +1,98 @@+# Setup decisions from project facts++Use this file after `experiment-setup-context` returned. Each section maps the tool's facts to one configuration choice and to a tier for the summary:++- **Confident**: the facts decide it.+- **Best guess**: a reasonable default that the facts support but do not prove. Say what would change it.+- **Not decided**: the facts cannot decide it. Say what is missing and how the user can decide.++Every section has the shape `{status, data}`. The field paths below are inside `data`: `target_surface.anonymous_share` means `target_surface.data.anonymous_share`.+A section whose `status` is not `ok` gives no facts. Choices that depend on it drop to "best guess" at most, and the summary says which section was missing.++## Bucketing and persistence++Read these facts:++- `target_surface.anonymous_share`: the share of distinct IDs on the page's web events that were not identified. A high share usually means logged-out visitors. It is null when no web SDK sent the target event (a mobile or server target).+- `target_surface.device_id_share`: the share of the page's web events that carry a device ID.+- `sdk_profile.libs`: per SDK, `device_id_share` and `locally_evaluated_share` on flag calls. It covers the whole project, not one page, so use `target_surface.libs` to pick the rows that apply to this page. It is empty when the project sent no multivariate flag calls in the last 7 days.++| Facts | Choice | Tier |+| ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------- |+| `anonymous_share` above about 0.9, or below about 0.1: the page is seen mostly by one kind of visitor | User-id bucketing. Leave `ensure_experience_continuity` out, so the team's persistence default applies | Best guess |+| Between: the same people likely see the page before and after they are identified, and user-id bucketing can switch their variant at that point | The steps below | Best guess, always listed for review |+| `anonymous_share` is null | User-id bucketing, team persistence default | Not decided: say the identity mix on this page is unknown |++When the page crosses identification, in this order:++1. **Device-id bucketing**, if `target_surface.device_id_share` is near 1, at least one `sdk_profile.libs` row has a `lib` that appears in `target_surface.libs`, and every matching row has `device_id_share` near 1. A flag call without a device ID gets no variant, so a server SDK must forward the browser's device ID; local evaluation works when it does. `target_surface.device_id_share` is read from the target events; a `sdk_profile.libs` row's `device_id_share` is read from flag-call events. Neither is read from the flag requests, so neither proves that the request carried a device ID. The web SDK sends the device ID on flag requests from posthog-js 1.307.1. An older version puts a device ID on events and still gets no variant, so tell the user to check the SDK version. Set it up with the device-id recipe in `configuring-experiment-rollout`. `experiment-create` cannot set it.+2. **Persistence** (`ensure_experience_continuity: true`), if no matching `sdk_profile.libs` row evaluates flags locally: every row that matches a `lib` in `target_surface.libs` has `locally_evaluated_share` near 0, or null on a web or mobile row. Null on a server row is unknown: go to step 3. Persistence also needs person profiles for anonymous users, no bootstrapping, and `$anon_distinct_id` on server flag calls. The tool cannot see those three, so list them for the user to check.+3. **Otherwise**: user-id bucketing, and mark it "not decided". Say what would unlock the other options: a device ID on every flag call, or no local evaluation.++If `sdk_profile.libs` is empty, or no row matches a `lib` in `target_surface.libs`, there is no evidence about device IDs on flag calls or about local evaluation, and steps 1 and 2 do not pass. Keep user-id bucketing and mark it "not decided". Say that device-id bucketing is the likely fit when `target_surface.device_id_share` is near 1 and `target_surface.libs` lists no server SDK.++Leave `ensure_experience_continuity` out unless you are choosing persistence. When omitted, `experiment-create` applies the team's default (`team_defaults.flags_persistence_default`). Set it to `false` only when the team default is `true` and local evaluation rules persistence out. The device-id recipe needs no such step: `create-feature-flag` leaves persistence off unless you set it, and `experiment-create` rejects a `feature_flag` object for a flag that already exists.++Never change bucketing or persistence on a flag that is already live.++## Where the flag is evaluated++If `sdk_profile.evaluated_on_server_and_web` is true, or `target_surface.libs` lists a server SDK next to `web`:++- The server and the browser must use the same identity and see the same flag value. Otherwise one person gets two variants.+- A custom exposure on a browser event is only safe when the browser holds the server's flag value at that moment, because the exposure reads `$feature/<flag>` from that event.+- With device-id bucketing, the server must forward the browser's device ID on every flag call. A call without one gets no variant.++Tier: **not decided**. The facts show the risk, not whether the code handles it. Tell the user what to check.++## Exposure++Keep the team's default exposure event (`team_defaults.default_exposure_event`). Use a custom exposure only when the user names the moment the person sees the change and the flag is evaluated well before it: a prefetch, a server render, or a flag read across the whole app while the change sits on one surface. Tier: best guess.++## Who counts++Keep the test-account filter on (creation turns it on by default) and say so. If `team_defaults.test_account_filter_count` is 0, say the project has no test-account filters. Tier: best guess.++## Primary metric++1. Pick the event that expresses the hypothesis. Confirm it exists with `read-data-schema`.+2. A `shared_metrics.metrics` entry with `matches_metric_event: true` is a candidate, not a match: the event appears somewhere in the metric, in any role. Load it with `experiment-saved-metrics-retrieve` and compare its `query` (metric type, the event's role, `math`) with what the user asked for.+ - If it matches, link it after creation through `experiment-update` with `saved_metrics_ids`, instead of building an inline metric. Tier: confident. When the user asked for no questions, link it and report it rather than asking first.+ - If it doesn't, build an inline metric.+3. Otherwise pick a shape from the metric templates in `configuring-experiment-analytics` (`references/metric-templates.md`). Tier: best guess.++Every conversion window carries a unit (`conversion_window_unit`). A window without a unit is ignored.++## Feasibility and running time++When `candidate_metric.status` is `ok` and it has baseline stats:++1. Call `experiment-calculate-running-time`:+ - funnel metric: `metric_type: "funnel"`, `baseline_stats` from `candidate_metric.funnel_baseline_stats`+ - count per user: `metric_type: "mean_count"`, `baseline_stats` from `candidate_metric.mean_count_baseline_stats`+ - `minimum_detectable_effect`: `team_defaults.minimum_detectable_effect`, else `team_defaults.product_default_minimum_detectable_effect`+ - `exposure_rate_per_day`: `target_surface.exposures_per_day_estimate`, times the rollout share when the experiment includes less than 100% of traffic+ - `number_of_variants` when there are more than two variants+2. Pass the result to `experiment-create` as `running_time_calculation`, so the plan is stored on the experiment:+ - `minimum_detectable_effect`: the value you sent (the calculator does not return it)+ - `recommended_sample_size`: the calculator's `recommended_sample_size`+ - `recommended_running_time`: the calculator's `recommended_running_time_days`+3. If the running time is over about 8 weeks, say so plainly. Propose a more frequent event earlier in the journey as primary and keep the rare event as secondary.++The estimate assumes people are exposed on the target surface. If the flag is evaluated more widely (across the whole app, or on a page before the one that changes), the exposed population is larger and converts less. The baseline and the running time are then too optimistic. Say so, and consider a custom exposure on the surface event.++`target_url_contains` is a substring match on the URL: a bare domain matches every page on it and overstates the page's traffic. Pass the most specific fragment you can.++Tier: confident on the arithmetic, best guess on the inputs (the baseline is an estimate over `candidate_metric.window_days`).++If `candidate_metric.persons_reached` is 0, no one sent the target event in the window: say the target may be wrong. If `persons_reached` is above 0 but `persons_converted` is 0, the metric event never follows the target: say the metric event may be misspelled or not yet instrumented.++## Precedent++Read `previous_experiments.summary`. Its `using_*` counts cover every listed experiment, drafts included, so read them as what the team sets up, not what it launches.++If most listed experiments use one setting (device-id bucketing, persistence, custom exposure), follow it unless the facts above contradict it, and say you followed precedent. For a holdout, look at `has_holdout` on the rows in `previous_experiments.experiments`. Tier: best guess.++## Statistics++Leave `stats_config` out, so the experiment follows the team's defaults (`stats_method`, `confidence_level`, CUPED, sequential testing). Set it only when the user asks for a different method. Tier: confident.diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex b7c8e1d36010..1165b231a09e 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -4313,7 +4313,7 @@}},"experiment-create": {- "description": "RULES (follow before calling):\n1. Load the creating-experiments skill for the full\n creation workflow.\n\n2. If the user mentions a rollout percentage (e.g. \"25%\"),\n load the configuring-experiment-rollout skill and\n ask the user to clarify BEFORE calling this tool.\n A percentage is always ambiguous — it can mean a\n variant split change OR an overall rollout change.\n\n3. Do NOT pass metrics on creation. Create the draft\n first, then add metrics via experiment-update. Use\n the configuring-experiment-analytics skill for\n metric guidance.\n\n\nCreates a new experiment in draft status (ignore the \"type\" param, since no-code/toolbar experiments must be created in the PostHog UI). Requires name and feature_flag_key. Feature flag is auto-created — do not create one separately. Defaults: 50/50 control/test, 100% rollout, Bayesian stats. Launch the experiment with the launch tool when ready.",+ "description": "RULES (follow before calling):\n1. Load the creating-experiments skill for the full\n creation workflow.\n\n2. If the user mentions a rollout percentage (e.g. \"25%\"),\n load the configuring-experiment-rollout skill and\n ask the user to clarify BEFORE calling this tool.\n A percentage is always ambiguous — it can mean a\n variant split change OR an overall rollout change.\n\n3. Do NOT pass metrics on creation. Create the draft\n first, then add metrics via experiment-update. Use\n the configuring-experiment-analytics skill for\n metric guidance.\n\n4. If experiment-setup-context is available, call it\n first and use its facts to choose bucketing,\n exposure and metrics.\n\n\nCreates a new experiment in draft status (ignore the \"type\" param, since no-code/toolbar experiments must be created in the PostHog UI). Requires name and feature_flag_key. Feature flag is auto-created — do not create one separately, except for device-id bucketing, which this tool cannot set: create the flag first with `create-feature-flag`. Defaults: 50/50 control/test, 100% rollout, the team's default stats method. Launch the experiment with the launch tool when ready.","category": "Experiments","feature": "experiments","summary": "Create experiment",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex decd4cd42495..08d6ba4f3811 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -4384,7 +4384,7 @@}},"experiment-create": {- "description": "RULES (follow before calling):\n1. Load the creating-experiments skill for the full\n creation workflow.\n\n2. If the user mentions a rollout percentage (e.g. \"25%\"),\n load the configuring-experiment-rollout skill and\n ask the user to clarify BEFORE calling this tool.\n A percentage is always ambiguous — it can mean a\n variant split change OR an overall rollout change.\n\n3. Do NOT pass metrics on creation. Create the draft\n first, then add metrics via experiment-update. Use\n the configuring-experiment-analytics skill for\n metric guidance.\n\n\nCreates a new experiment in draft status (ignore the \"type\" param, since no-code/toolbar experiments must be created in the PostHog UI). Requires name and feature_flag_key. Feature flag is auto-created — do not create one separately. Defaults: 50/50 control/test, 100% rollout, Bayesian stats. Launch the experiment with the launch tool when ready.",+ "description": "RULES (follow before calling):\n1. Load the creating-experiments skill for the full\n creation workflow.\n\n2. If the user mentions a rollout percentage (e.g. \"25%\"),\n load the configuring-experiment-rollout skill and\n ask the user to clarify BEFORE calling this tool.\n A percentage is always ambiguous — it can mean a\n variant split change OR an overall rollout change.\n\n3. Do NOT pass metrics on creation. Create the draft\n first, then add metrics via experiment-update. Use\n the configuring-experiment-analytics skill for\n metric guidance.\n\n4. If experiment-setup-context is available, call it\n first and use its facts to choose bucketing,\n exposure and metrics.\n\n\nCreates a new experiment in draft status (ignore the \"type\" param, since no-code/toolbar experiments must be created in the PostHog UI). Requires name and feature_flag_key. Feature flag is auto-created — do not create one separately, except for device-id bucketing, which this tool cannot set: create the flag first with `create-feature-flag`. Defaults: 50/50 control/test, 100% rollout, the team's default stats method. Launch the experiment with the launch tool when ready.","category": "Experiments","feature": "experiments","summary": "Create experiment",