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.

feat(experiments/mcp): expose freeze/unfreeze exposure lifecycle actions over MCP (#72218)

Marcel Poelkerba7aec1769c7
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yaml
index c0c08fe3f15a..e9e124a3d877 100644
--- a/products/experiments/mcp/tools.yaml
+++ b/products/experiments/mcp/tools.yaml
@@ -325,6 +325,57 @@ tools:
id:
cast: string-int
ui_app: experiment
+ experiment-freeze-exposure:
+ operation: experiments_freeze_exposure_create
+ enabled: true
+ scopes:
+ - experiment:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ enrich_url: '{id}'
+ title: Freeze experiment exposure
+ description: >
+ Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the
+ user's reference first. Load the managing-experiment-lifecycle skill for preconditions, limitations, and
+ side effects.
+
+
+ Freeze exposure on a running experiment: stop enrolling NEW users while already-enrolled users keep their
+ variant and metrics keep flowing (end_date stays null). Snapshots the already-exposed users into a static
+ cohort and narrows every release condition on the feature flag to that cohort. Use for long-horizon metrics
+ (revenue, LTV, retention, renewals) where enrollment should stop but measurement should continue — unlike
+ end (stops measurement at end_date) or pause (deactivates the flag for everyone). Status becomes
+ "exposure_frozen". Reversible via experiment-unfreeze-exposure.
+
+
+ SYNCHRONOUS AND POTENTIALLY SLOW: the exposure scan and cohort snapshot run inline in this call, and
+ duration scales with the number of exposed persons — experiments with tens of thousands of exposed users can
+ take tens of seconds. Wait for the response rather than assuming failure or retrying.
+
+
+ Not applicable (returns 400) for: experiments that aren't running ("Experiment has not been launched yet.",
+ "Experiment has already ended.", "Cannot freeze a paused experiment. Resume it first.", "Experiment exposure
+ is already frozen."), group-aggregated experiments (a person cohort cannot freeze group-based matching),
+ experiments in a holdout (holdout assignment is evaluated before release conditions), flags with early
+ access conditions (also evaluated before release conditions), flags that are deleted, missing, or have no
+ release conditions, exposed sets too large to snapshot synchronously (the scan is bounded by a person cap
+ and a timeout), and experiments where more than a small share of exposures are anonymous ("personless")
+ users — they can never match a person cohort, so experiments on logged-out surfaces are not freezable. When
+ a freeze is rejected, explain the limitation to the user instead of retrying.
+
+
+ Good to know: SDKs using local evaluation cannot resolve static cohorts, so a frozen flag evaluates via the
+ /decide endpoint; exposures ingested in the final moments before freezing may miss the snapshot;
+ ship-variant and reset strip the freeze, while end leaves the flag narrowed to the snapshot cohort.
+
+
+ No request body needed.
+ param_overrides:
+ id:
+ cast: string-int
+ ui_app: experiment
experiment-get:
operation: experiments_retrieve
enabled: true
@@ -904,6 +955,45 @@ tools:
Returns 400 if the experiment is not currently archived ("Experiment is not archived.").
+ No request body needed.
+ param_overrides:
+ id:
+ cast: string-int
+ ui_app: experiment
+ experiment-unfreeze-exposure:
+ operation: experiments_unfreeze_exposure_create
+ enabled: true
+ scopes:
+ - experiment:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ enrich_url: '{id}'
+ title: Unfreeze experiment exposure
+ description: >
+ Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the
+ user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.
+
+
+ Reopen enrollment on an exposure-frozen experiment. Removes the snapshot-cohort condition and freeze markers
+ from every release group, restoring the flag's original targeting: new users can enroll again and
+ already-enrolled users keep their variant (deterministic bucketing). The snapshot cohort is deleted. Status
+ returns to "running".
+
+
+ WARNING — can introduce bias: reopening enrollment re-exposes the flag to a potentially new population.
+ Users who enrolled before the freeze and users who enroll after the unfreeze joined at different times (and
+ possibly under different conditions), so mixing the two cohorts in one analysis can bias the results. Warn
+ the user about this before unfreezing, especially if the freeze lasted a while or something about the
+ audience or product changed in between. If they only wanted to sanity-check the frozen results, they may not
+ need to unfreeze at all.
+
+
+ Returns 400 if the experiment is a draft ("Experiment has not been launched yet."), already ended
+ ("Experiment has already ended."), or its exposure is not frozen ("Experiment exposure is not frozen.").
+
+
No request body needed.
param_overrides:
id:
@@ -1036,9 +1126,6 @@ tools:
experiments-flag-cleanup-task-retrieve:
operation: experiments_flag_cleanup_task_retrieve
enabled: false
- experiments-freeze-exposure-create:
- operation: experiments_freeze_exposure_create
- enabled: false
experiments-metrics-recalculation-create:
operation: experiments_metrics_recalculation_create
enabled: false
@@ -1057,9 +1144,6 @@ tools:
experiments-session-context-retrieve:
operation: experiments_session_context_retrieve
enabled: false
- experiments-unfreeze-exposure-create:
- operation: experiments_unfreeze_exposure_create
- enabled: false
experiments-update:
operation: experiments_update
enabled: false
diff --git a/products/experiments/skills/configuring-experiment-rollout/SKILL.md b/products/experiments/skills/configuring-experiment-rollout/SKILL.md
index e2a886ed20b1..416bb4d4b9bc 100644
--- a/products/experiments/skills/configuring-experiment-rollout/SKILL.md
+++ b/products/experiments/skills/configuring-experiment-rollout/SKILL.md
@@ -194,6 +194,9 @@ Present the warning covering both perspectives:
**Exception**: Increasing rollout (without changing the split) is generally safe — no users switch variants, more users are added cleanly.
+**If the goal is "stop new users from entering" rather than a percentage change**: reducing the rollout is the wrong tool — it drops already-enrolled users out of the experiment too.
+Freezing exposure (`experiment-freeze-exposure`) closes enrollment while enrolled users keep their variant and metrics keep flowing; see `managing-experiment-lifecycle` for its preconditions and limitations.
+
**Mid-experiment fix for uneven-split bias**: switching multivariate handling from "Exclude" to "First
seen variant" is the recommended mitigation for already-launched experiments — no users switch variants
and all collected data stays in the analysis. Changing the split to be even is an anti-pattern mid-run
diff --git a/products/experiments/skills/diagnosing-experiment-results/references/empty-experiment.md b/products/experiments/skills/diagnosing-experiment-results/references/empty-experiment.md
index 65e6faf31289..5ff7b27a88ea 100644
--- a/products/experiments/skills/diagnosing-experiment-results/references/empty-experiment.md
+++ b/products/experiments/skills/diagnosing-experiment-results/references/empty-experiment.md
@@ -304,8 +304,11 @@ Ask explicitly. The "empty experiment" shape often resolves to a feature flag st
branch that hasn't merged, or a page that calls the flag not being live yet.
**Exposures were healthy then stopped** (the experiment ran for weeks/months, then the daily
-exposure count plateaued and never moved again). A different shape — capture and config are
-both fine; the application stopped calling the flag.
+exposure count plateaued and never moved again). Before investigating, check the experiment's
+status from Step 1: `exposure_frozen` means someone deliberately froze exposure — the plateau is
+the intended behavior (enrollment closed, metrics still flowing), not a bug. Likewise `paused`
+explains a hard stop. Otherwise, this is a different shape — capture and config are both fine;
+the application stopped calling the flag.
_Verify directly:_
diff --git a/products/experiments/skills/finding-experiments/SKILL.md b/products/experiments/skills/finding-experiments/SKILL.md
index abbea894e90f..fb8933b17bd5 100644
--- a/products/experiments/skills/finding-experiments/SKILL.md
+++ b/products/experiments/skills/finding-experiments/SKILL.md
@@ -1,6 +1,6 @@
---
name: finding-experiments
-description: Resolves a PostHog experiment reference from natural language to a concrete experiment ID by browsing `experiment-list` (not feature-flag tools), with disambiguation when multiple experiments match. Use when the user names or quotes an experiment ("split test demo", "the File engagement boost experiment", "onboarding retention test", "landing page hero experiment", "pricing experiment"), describes it loosely ("the signup experiment", "my pricing test", "the one with the new checkout"), uses a relative reference ("latest", "most recent", "the one I created yesterday"), filters by status (running, draft, stopped, archived), or otherwise refers to an experiment by anything other than its concrete ID.
+description: Resolves a PostHog experiment reference from natural language to a concrete experiment ID by browsing `experiment-list` (not feature-flag tools), with disambiguation when multiple experiments match. Use when the user names or quotes an experiment ("split test demo", "the File engagement boost experiment", "onboarding retention test", "landing page hero experiment", "pricing experiment"), describes it loosely ("the signup experiment", "my pricing test", "the one with the new checkout"), uses a relative reference ("latest", "most recent", "the one I created yesterday"), filters by status (running, draft, paused, exposure frozen, stopped, archived), or otherwise refers to an experiment by anything other than its concrete ID.
---
# Finding experiments
@@ -21,7 +21,7 @@ experiment matching the user's reference:
- **By name**: scan the `name` field for matches
- **By recency**: results are ordered newest first by default
-- **By status**: match the `status` field (draft, running, stopped)
+- **By status**: match the `status` field (draft, running, paused, exposure_frozen, stopped)
- **By flag key**: match the `feature_flag_key` field
## After finding matches
diff --git a/products/experiments/skills/managing-experiment-lifecycle/SKILL.md b/products/experiments/skills/managing-experiment-lifecycle/SKILL.md
index 727c1490d5bd..5e774ef045c0 100644
--- a/products/experiments/skills/managing-experiment-lifecycle/SKILL.md
+++ b/products/experiments/skills/managing-experiment-lifecycle/SKILL.md
@@ -1,6 +1,6 @@
---
name: managing-experiment-lifecycle
-description: "Guides experiment state transitions: launching, pausing, resuming, ending, shipping variants, archiving, resetting, duplicating, and copying to another project. Covers preconditions, implications for variant assignment and analysis, and the decision framework for when to use each action.\nTRIGGER when: user asks to launch, pause, resume, end, ship, archive, reset, duplicate, or copy an experiment to another project.\nDO NOT TRIGGER when: user is creating an experiment (use creating-experiments), configuring rollout (use configuring-experiment-rollout), or setting up metrics (use configuring-experiment-analytics)."
+description: "Guides experiment state transitions: launching, pausing, resuming, freezing/unfreezing exposure, ending, shipping variants, archiving, resetting, duplicating, and copying to another project. Covers preconditions, implications for variant assignment and analysis, and the decision framework for when to use each action.\nTRIGGER when: user asks to launch, pause, resume, end, ship, archive, reset, duplicate, or copy an experiment to another project, or to freeze/unfreeze exposure (stop enrolling new users while metrics keep flowing, or reopen enrollment).\nDO NOT TRIGGER when: user is creating an experiment (use creating-experiments), configuring rollout (use configuring-experiment-rollout), or setting up metrics (use configuring-experiment-analytics)."
---
# Managing experiment lifecycle
@@ -11,11 +11,14 @@ This skill covers experiment state transitions — what each action does, when t
```text
draft ──launch──▶ running ──end──▶ stopped ──archive──▶ archived
- │ ▲ │
- pause resume ship_variant
- │ │ (also ends if running)
- ▼ │
- paused (flag inactive, still "running" status)
+ │ │ ▲ │
+ │ pause resume ship_variant
+ │ │ │ (also ends if running)
+ │ ▼ │
+ │ paused (flag inactive, still "running" status)
+ │
+ ├─freeze_exposure──▶ exposure_frozen ──unfreeze_exposure──▶ running
+ │ (enrollment closed, metrics keep flowing)
Any non-draft state ──reset──▶ draft
```
@@ -58,6 +61,54 @@ Reactivates the feature flag after a pause. Users are re-bucketed deterministica
No request body.
+### Freeze exposure (`experiment-freeze-exposure`)
+
+Stops enrolling **new** users while everything else keeps going: already-enrolled users keep their variant, metrics keep flowing, and `end_date` stays null.
+Snapshots the already-exposed users into a static cohort and narrows every release condition on the feature flag to that cohort.
+Status becomes `exposure_frozen`.
+
+Use for long-horizon metrics (revenue, LTV, retention, renewals) when the sample is big enough and you want to stop adding users without stopping measurement.
+Neither end nor pause fits that job: end stops measurement at `end_date`, and pause deactivates the flag for everyone.
+
+- **Preconditions**: must be running (not draft, stopped, paused, or already frozen), flag linked and not deleted, at least one release condition
+- **Variants**: enrolled users keep their variant (deterministic bucketing); new users no longer match the flag
+- **Analysis**: exposures stop growing (a flat exposure curve is expected), but metric data keeps accumulating for enrolled users
+
+**Timing**: the exposure scan and cohort snapshot run synchronously inside the API call, and duration scales with the number of exposed persons — an experiment with tens of thousands of exposed users can take on the order of tens of seconds.
+Set expectations with the user, wait for the response, and don't treat a slow call as a failure or retry it.
+
+**Not applicable (400) for**:
+
+- **Group-aggregated experiments** — the flag targets groups, not persons, and a person cohort can't freeze group-based matching
+- **Experiments in a holdout** — holdout assignment is evaluated before release conditions, so new users would keep entering the holdout
+- **Flags with early access conditions** — also evaluated before release conditions, so freezing can't stop new enrollment
+- **Mostly-anonymous exposure** (e.g. experiments on logged-out surfaces) — anonymous "personless" users can never match a person cohort and would silently lose their variant, so freezes with more than a small unresolved share are rejected
+- **Very large exposed sets** — the exposure scan is bounded by a person cap and a timeout; over either bound the API returns a clean 400 rather than freezing
+
+When a freeze is rejected, explain which limitation applies rather than retrying — these are structural, not transient.
+
+**Interactions with other actions**: ship-variant and reset strip the freeze (both also delete the snapshot cohort); end does NOT touch the flag, so ending a frozen experiment leaves the flag narrowed to the snapshot cohort.
+SDKs using local evaluation can't resolve static cohorts, so a frozen flag evaluates via the `/decide` endpoint (standard static-cohort behavior).
+Exposures ingested in the final moments before freezing may miss the snapshot (ingestion lag).
+
+No request body. Use `experiment-unfreeze-exposure` to reopen enrollment.
+
+### Unfreeze exposure (`experiment-unfreeze-exposure`)
+
+Reopens enrollment on an exposure-frozen experiment.
+Removes the snapshot-cohort condition and freeze markers from every release group, restoring the flag's original targeting, and deletes the snapshot cohort.
+Status returns to `running`.
+
+- **Preconditions**: exposure must be frozen (and the experiment not ended)
+- **Variants**: enrolled users keep their variant; new users can enroll again under the original release conditions
+- **Analysis**: exposures resume growing
+
+**Can introduce bias**: reopening enrollment re-exposes the flag to a potentially new population.
+Users who enrolled before the freeze and those who enroll after the unfreeze joined at different times, and possibly under different conditions — mixing the two cohorts in one analysis can bias the results.
+Warn the user before unfreezing, especially after a long freeze or if the audience or product changed in between. If they only wanted to sanity-check the frozen results, they may not need to unfreeze at all.
+
+No request body.
+
### End (`experiment-end`)
Sets `end_date` and transitions to stopped. The feature flag is **NOT modified**.
@@ -69,6 +120,7 @@ Sets `end_date` and transitions to stopped. The feature flag is **NOT modified**
Optional body: `conclusion` ("won", "lost", "inconclusive", "stopped_early", "invalid") and `conclusion_comment`.
Use this when you want to freeze results without changing what users see.
+If the experiment's exposure was frozen, ending does not strip the freeze — the flag stays narrowed to the snapshot cohort (unfreeze first, or ship a variant, if that's not desired).
### Ship variant (`experiment-ship-variant`)
@@ -138,17 +190,19 @@ isn't looking at. The returned experiment (and its id) belongs to the target pro
## Decision framework
-| Situation | Action | Tool |
-| -------------------------------------------------- | ------------------------ | ---------------------------- |
-| Draft ready, flag implemented, metrics set | Launch | `experiment-launch` |
-| Clear winner, significant results | Ship the winning variant | `experiment-ship-variant` |
-| No significant difference after sufficient time | End as inconclusive | `experiment-end` |
-| Something wrong, need to stop exposure temporarily | Pause | `experiment-pause` |
-| Resume after pause | Resume | `experiment-resume` |
-| Experiment ended, ready to clean up | Archive | `experiment-archive` |
-| Need to start over with same config | Reset to draft | `experiment-reset` |
-| Want a similar experiment with a fresh start | Duplicate | `experiment-duplicate` |
-| Want the same experiment in a different project | Copy to another project | `experiment-copy-to-project` |
+| Situation | Action | Tool |
+| -------------------------------------------------- | ------------------------ | ------------------------------ |
+| Draft ready, flag implemented, metrics set | Launch | `experiment-launch` |
+| Clear winner, significant results | Ship the winning variant | `experiment-ship-variant` |
+| No significant difference after sufficient time | End as inconclusive | `experiment-end` |
+| Something wrong, need to stop exposure temporarily | Pause | `experiment-pause` |
+| Resume after pause | Resume | `experiment-resume` |
+| Stop enrolling new users, keep measuring enrolled | Freeze exposure | `experiment-freeze-exposure` |
+| Reopen enrollment after a freeze | Unfreeze exposure | `experiment-unfreeze-exposure` |
+| Experiment ended, ready to clean up | Archive | `experiment-archive` |
+| Need to start over with same config | Reset to draft | `experiment-reset` |
+| Want a similar experiment with a fresh start | Duplicate | `experiment-duplicate` |
+| Want the same experiment in a different project | Copy to another project | `experiment-copy-to-project` |
## Resolving experiments
@@ -158,14 +212,18 @@ All lifecycle actions require an experiment ID. If you don't have one, load the
## Error handling
-| Error message | Meaning |
-| --------------------------------------- | ------------------------------------ |
-| "Experiment has already been launched." | Can't launch a non-draft experiment |
-| "Experiment has not been launched yet." | Can't end/pause/ship a draft |
-| "Experiment has already ended." | Can't end/pause a stopped experiment |
-| "Experiment is already paused." | Use resume instead |
-| "Experiment is not paused." | It's already active |
-| "Experiment is already in draft state." | Nothing to reset |
-| "Experiment is already archived." | Already done |
+| Error message | Meaning |
+| ----------------------------------------------------------------- | ------------------------------------ |
+| "Experiment has already been launched." | Can't launch a non-draft experiment |
+| "Experiment has not been launched yet." | Can't end/pause/ship a draft |
+| "Experiment has already ended." | Can't end/pause a stopped experiment |
+| "Experiment is already paused." | Use resume instead |
+| "Experiment is not paused." | It's already active |
+| "Experiment is already in draft state." | Nothing to reset |
+| "Experiment is already archived." | Already done |
+| "Experiment exposure is already frozen." | Nothing to freeze |
+| "Experiment exposure is not frozen." | Nothing to unfreeze |
+| "Cannot freeze a paused experiment. Resume it first." | Resume, then freeze |
+| "Group-aggregated experiments cannot have their exposure frozen." | Structural limitation — don't retry |
When you get a 400, explain the situation to the user rather than retrying.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index cb31db10d597..3f39e681d378 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -3502,6 +3502,20 @@
"readOnlyHint": false
}
},
+ "experiment-freeze-exposure": {
+ "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions, limitations, and side effects.\n\nFreeze exposure on a running experiment: stop enrolling NEW users while already-enrolled users keep their variant and metrics keep flowing (end_date stays null). Snapshots the already-exposed users into a static cohort and narrows every release condition on the feature flag to that cohort. Use for long-horizon metrics (revenue, LTV, retention, renewals) where enrollment should stop but measurement should continue — unlike end (stops measurement at end_date) or pause (deactivates the flag for everyone). Status becomes \"exposure_frozen\". Reversible via experiment-unfreeze-exposure.\n\nSYNCHRONOUS AND POTENTIALLY SLOW: the exposure scan and cohort snapshot run inline in this call, and duration scales with the number of exposed persons — experiments with tens of thousands of exposed users can take tens of seconds. Wait for the response rather than assuming failure or retrying.\n\nNot applicable (returns 400) for: experiments that aren't running (\"Experiment has not been launched yet.\", \"Experiment has already ended.\", \"Cannot freeze a paused experiment. Resume it first.\", \"Experiment exposure is already frozen.\"), group-aggregated experiments (a person cohort cannot freeze group-based matching), experiments in a holdout (holdout assignment is evaluated before release conditions), flags with early access conditions (also evaluated before release conditions), flags that are deleted, missing, or have no release conditions, exposed sets too large to snapshot synchronously (the scan is bounded by a person cap and a timeout), and experiments where more than a small share of exposures are anonymous (\"personless\") users — they can never match a person cohort, so experiments on logged-out surfaces are not freezable. When a freeze is rejected, explain the limitation to the user instead of retrying.\n\nGood to know: SDKs using local evaluation cannot resolve static cohorts, so a frozen flag evaluates via the /decide endpoint; exposures ingested in the final moments before freezing may miss the snapshot; ship-variant and reset strip the freeze, while end leaves the flag narrowed to the snapshot cohort.\n\nNo request body needed.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Freeze experiment exposure",
+ "title": "Freeze experiment exposure",
+ "required_scopes": ["experiment:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"experiment-get": {
"description": "Get a single experiment by ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, parameters (including feature_flag_variants and recommended_running_time), stats_config, and type (web/product).",
"category": "Experiments",
@@ -3782,6 +3796,20 @@
"readOnlyHint": false
}
},
+ "experiment-unfreeze-exposure": {
+ "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nReopen enrollment on an exposure-frozen experiment. Removes the snapshot-cohort condition and freeze markers from every release group, restoring the flag's original targeting: new users can enroll again and already-enrolled users keep their variant (deterministic bucketing). The snapshot cohort is deleted. Status returns to \"running\".\n\nWARNING — can introduce bias: reopening enrollment re-exposes the flag to a potentially new population. Users who enrolled before the freeze and users who enroll after the unfreeze joined at different times (and possibly under different conditions), so mixing the two cohorts in one analysis can bias the results. Warn the user about this before unfreezing, especially if the freeze lasted a while or something about the audience or product changed in between. If they only wanted to sanity-check the frozen results, they may not need to unfreeze at all.\n\nReturns 400 if the experiment is a draft (\"Experiment has not been launched yet.\"), already ended (\"Experiment has already ended.\"), or its exposure is not frozen (\"Experiment exposure is not frozen.\").\n\nNo request body needed.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Unfreeze experiment exposure",
+ "title": "Unfreeze experiment exposure",
+ "required_scopes": ["experiment:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"experiment-update": {
"description": "RULES (follow before calling):\n1. If changing rollout or variants on a RUNNING\n experiment, you MUST warn the user about user\n experience AND statistical implications BEFORE\n making the change and get explicit confirmation.\n Load the configuring-experiment-rollout skill for\n the full warning. Do NOT silently apply the change\n — even if the user asked directly.\n\n2. If the user mentions a percentage, clarify whether\n they mean variant split or overall rollout BEFORE\n calling.\n\n3. If adding or changing metrics, load the\n configuring-experiment-analytics skill first. Call\n read-data-schema to discover available events BEFORE\n suggesting or using any event name. Never suggest\n event names you haven't confirmed exist.\n\n4. For running experiments, set\n update_feature_flag_params=true when changing\n feature_flag config — without it, the request is\n rejected because the change would not sync to the\n feature flag.\n\n5. Setting allow_unknown_events=true REQUIRES EXPLICIT\n USER CONFIRMATION. When the API returns\n \"Event(s) '...' not found\", do NOT silently retry\n with allow_unknown_events=true. Default to\n course-correcting: surface the missing event names\n and ask whether the user meant a different (existing)\n event. Only set allow_unknown_events=true when the\n user explicitly confirms the event is intentional\n (e.g. about to be instrumented). Course-correcting\n to a known event is the expected default; flipping\n the flag is the exception.\n\n\nUpdate an experiment by ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Metrics can be changed at any time including while running. Cannot add/remove variants on non-draft experiments (changing percentages between existing variants is allowed). Cannot change holdout on non-draft experiments.\n\nDo NOT use this to change lifecycle state — use the dedicated launch, end, pause, resume, archive, or experiment-ship-variant tools instead.",
"category": "Experiments",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 1e4b268a5864..44ac5988dd5e 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -3671,6 +3671,20 @@
"readOnlyHint": false
}
},
+ "experiment-freeze-exposure": {
+ "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions, limitations, and side effects.\n\nFreeze exposure on a running experiment: stop enrolling NEW users while already-enrolled users keep their variant and metrics keep flowing (end_date stays null). Snapshots the already-exposed users into a static cohort and narrows every release condition on the feature flag to that cohort. Use for long-horizon metrics (revenue, LTV, retention, renewals) where enrollment should stop but measurement should continue — unlike end (stops measurement at end_date) or pause (deactivates the flag for everyone). Status becomes \"exposure_frozen\". Reversible via experiment-unfreeze-exposure.\n\nSYNCHRONOUS AND POTENTIALLY SLOW: the exposure scan and cohort snapshot run inline in this call, and duration scales with the number of exposed persons — experiments with tens of thousands of exposed users can take tens of seconds. Wait for the response rather than assuming failure or retrying.\n\nNot applicable (returns 400) for: experiments that aren't running (\"Experiment has not been launched yet.\", \"Experiment has already ended.\", \"Cannot freeze a paused experiment. Resume it first.\", \"Experiment exposure is already frozen.\"), group-aggregated experiments (a person cohort cannot freeze group-based matching), experiments in a holdout (holdout assignment is evaluated before release conditions), flags with early access conditions (also evaluated before release conditions), flags that are deleted, missing, or have no release conditions, exposed sets too large to snapshot synchronously (the scan is bounded by a person cap and a timeout), and experiments where more than a small share of exposures are anonymous (\"personless\") users — they can never match a person cohort, so experiments on logged-out surfaces are not freezable. When a freeze is rejected, explain the limitation to the user instead of retrying.\n\nGood to know: SDKs using local evaluation cannot resolve static cohorts, so a frozen flag evaluates via the /decide endpoint; exposures ingested in the final moments before freezing may miss the snapshot; ship-variant and reset strip the freeze, while end leaves the flag narrowed to the snapshot cohort.\n\nNo request body needed.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Freeze experiment exposure",
+ "title": "Freeze experiment exposure",
+ "required_scopes": ["experiment:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"experiment-get": {
"description": "Get a single experiment by ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first.\n\nReturns the full experiment object including: status (draft/running/paused/exposure_frozen/stopped — \"paused\" is a virtual value returned when the experiment is launched but its feature flag has been deactivated, \"exposure_frozen\" when its flag's release groups are narrowed to the already-exposed cohort so enrollment is closed while metrics keep flowing), start_date and end_date, linked feature_flag (with variants, filters, active state), metrics and metrics_secondary arrays, conclusion and conclusion_comment if ended, parameters (including feature_flag_variants and recommended_running_time), stats_config, and type (web/product).",
"category": "Experiments",
@@ -3979,6 +3993,20 @@
"readOnlyHint": false
}
},
+ "experiment-unfreeze-exposure": {
+ "description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nReopen enrollment on an exposure-frozen experiment. Removes the snapshot-cohort condition and freeze markers from every release group, restoring the flag's original targeting: new users can enroll again and already-enrolled users keep their variant (deterministic bucketing). The snapshot cohort is deleted. Status returns to \"running\".\n\nWARNING — can introduce bias: reopening enrollment re-exposes the flag to a potentially new population. Users who enrolled before the freeze and users who enroll after the unfreeze joined at different times (and possibly under different conditions), so mixing the two cohorts in one analysis can bias the results. Warn the user about this before unfreezing, especially if the freeze lasted a while or something about the audience or product changed in between. If they only wanted to sanity-check the frozen results, they may not need to unfreeze at all.\n\nReturns 400 if the experiment is a draft (\"Experiment has not been launched yet.\"), already ended (\"Experiment has already ended.\"), or its exposure is not frozen (\"Experiment exposure is not frozen.\").\n\nNo request body needed.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Unfreeze experiment exposure",
+ "title": "Unfreeze experiment exposure",
+ "required_scopes": ["experiment:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"experiment-update": {
"description": "RULES (follow before calling):\n1. If changing rollout or variants on a RUNNING\n experiment, you MUST warn the user about user\n experience AND statistical implications BEFORE\n making the change and get explicit confirmation.\n Load the configuring-experiment-rollout skill for\n the full warning. Do NOT silently apply the change\n — even if the user asked directly.\n\n2. If the user mentions a percentage, clarify whether\n they mean variant split or overall rollout BEFORE\n calling.\n\n3. If adding or changing metrics, load the\n configuring-experiment-analytics skill first. Call\n read-data-schema to discover available events BEFORE\n suggesting or using any event name. Never suggest\n event names you haven't confirmed exist.\n\n4. For running experiments, set\n update_feature_flag_params=true when changing\n feature_flag config — without it, the request is\n rejected because the change would not sync to the\n feature flag.\n\n5. Setting allow_unknown_events=true REQUIRES EXPLICIT\n USER CONFIRMATION. When the API returns\n \"Event(s) '...' not found\", do NOT silently retry\n with allow_unknown_events=true. Default to\n course-correcting: surface the missing event names\n and ask whether the user meant a different (existing)\n event. Only set allow_unknown_events=true when the\n user explicitly confirms the event is intentional\n (e.g. about to be instrumented). Course-correcting\n to a known event is the expected default; flipping\n the flag is the exception.\n\n\nUpdate an experiment by ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Metrics can be changed at any time including while running. Cannot add/remove variants on non-draft experiments (changing percentages between existing variants is allowed). Cannot change holdout on non-draft experiments.\n\nDo NOT use this to change lifecycle state — use the dedicated launch, end, pause, resume, archive, or experiment-ship-variant tools instead.",
"category": "Experiments",
diff --git a/services/mcp/src/generated/experiments/api.ts b/services/mcp/src/generated/experiments/api.ts
index c3cce119246b..d37a9bbb0db7 100644
--- a/services/mcp/src/generated/experiments/api.ts
+++ b/services/mcp/src/generated/experiments/api.ts
@@ -3,7 +3,7 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 28 enabled ops
+ * PostHog API - MCP 30 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
@@ -11582,6 +11582,28 @@ export const ExperimentsEndCreateBody = /* @__PURE__ */ zod.object({
),
})
+/**
+ * Freeze exposure on a running experiment while metrics keep flowing.
+ *
+ * Snapshots the already-exposed users into a static cohort and narrows the
+ * linked feature flag so only those users keep matching — new users can no
+ * longer enter the experiment. ``end_date`` is left null so long-term metrics
+ * (revenue/LTV/renewals/retention) keep accumulating. Enrolled users keep
+ * their assigned variant. The serialized status becomes 'exposure_frozen'.
+ *
+ * Returns 400 if the experiment is not running, exposure is already frozen,
+ * the experiment is group-aggregated (group flags cannot be frozen with a
+ * person cohort), or the exposed set is too large to snapshot synchronously.
+ */
+export const ExperimentsFreezeExposureCreateParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this experiment.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
/**
* Launch a draft experiment.
*
@@ -11768,6 +11790,25 @@ export const ExperimentsUnarchiveCreateParams = /* @__PURE__ */ zod.object({
),
})
+/**
+ * Reopen enrollment on an exposure-frozen experiment.
+ *
+ * Removes the snapshot-cohort condition and freeze markers from every release
+ * group, restoring the flag's original targeting: new users can enroll again
+ * and already-enrolled users keep their assigned variant. The snapshot cohort
+ * is soft-deleted. The serialized status returns to 'running'.
+ *
+ * Returns 400 if the experiment is not running or its exposure is not frozen.
+ */
+export const ExperimentsUnfreezeExposureCreateParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this experiment.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
/**
* Estimate the recommended sample size and running time for an experiment.
*
diff --git a/services/mcp/src/tools/generated/experiments.ts b/services/mcp/src/tools/generated/experiments.ts
index b366ca21fb69..c495cde3a9fe 100644
--- a/services/mcp/src/tools/generated/experiments.ts
+++ b/services/mcp/src/tools/generated/experiments.ts
@@ -26,6 +26,7 @@ import {
ExperimentsDuplicateCreateParams,
ExperimentsEndCreateBody,
ExperimentsEndCreateParams,
+ ExperimentsFreezeExposureCreateParams,
ExperimentsLaunchCreateParams,
ExperimentsListQueryParams,
ExperimentsPartialUpdateBody,
@@ -39,6 +40,7 @@ import {
ExperimentsTimeseriesResultsRetrieveParams,
ExperimentsTimeseriesResultsRetrieveQueryParams,
ExperimentsUnarchiveCreateParams,
+ ExperimentsUnfreezeExposureCreateParams,
} from '@/generated/experiments/api'
import { withUiApp } from '@/resources/ui-apps'
import { SavedMetricsAttachSchema } from '@/schema/tool-inputs'
@@ -347,6 +349,27 @@ const experimentEnd = (): ToolBase<typeof ExperimentEndSchema, WithPostHogUrl<Sc
},
})
+const ExperimentFreezeExposureSchema = ExperimentsFreezeExposureCreateParams.omit({ project_id: true }).extend({
+ id: z.preprocess(castStringToInt, ExperimentsFreezeExposureCreateParams.shape['id']),
+})
+
+const experimentFreezeExposure = (): ToolBase<
+ typeof ExperimentFreezeExposureSchema,
+ WithPostHogUrl<Schemas.Experiment>
+> =>
+ withUiApp('experiment', {
+ name: 'experiment-freeze-exposure',
+ schema: ExperimentFreezeExposureSchema,
+ handler: async (context: Context, params: z.infer<typeof ExperimentFreezeExposureSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.Experiment>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/experiments/${encodeURIComponent(String(params.id))}/freeze_exposure/`,
+ })
+ return await withPostHogUrl(context, result, `/experiments/${result.id}`)
+ },
+ })
+
const ExperimentGetSchema = ExperimentsRetrieveParams.omit({ project_id: true }).extend({
id: z.preprocess(castStringToInt, ExperimentsRetrieveParams.shape['id']),
})
@@ -881,6 +904,27 @@ const experimentUnarchive = (): ToolBase<typeof ExperimentUnarchiveSchema, WithP
},
})
+const ExperimentUnfreezeExposureSchema = ExperimentsUnfreezeExposureCreateParams.omit({ project_id: true }).extend({
+ id: z.preprocess(castStringToInt, ExperimentsUnfreezeExposureCreateParams.shape['id']),
+})
+
+const experimentUnfreezeExposure = (): ToolBase<
+ typeof ExperimentUnfreezeExposureSchema,
+ WithPostHogUrl<Schemas.Experiment>
+> =>
+ withUiApp('experiment', {
+ name: 'experiment-unfreeze-exposure',
+ schema: ExperimentUnfreezeExposureSchema,
+ handler: async (context: Context, params: z.infer<typeof ExperimentUnfreezeExposureSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.Experiment>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/experiments/${encodeURIComponent(String(params.id))}/unfreeze_exposure/`,
+ })
+ return await withPostHogUrl(context, result, `/experiments/${result.id}`)
+ },
+ })
+
const ExperimentUpdateSchema = ExperimentsPartialUpdateParams.omit({ project_id: true })
.extend(
ExperimentsPartialUpdateBody.omit({
@@ -1003,6 +1047,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'experiment-delete': experimentDelete,
'experiment-duplicate': experimentDuplicate,
'experiment-end': experimentEnd,
+ 'experiment-freeze-exposure': experimentFreezeExposure,
'experiment-get': experimentGet,
'experiment-holdouts-create': experimentHoldoutsCreate,
'experiment-holdouts-destroy': experimentHoldoutsDestroy,
@@ -1023,5 +1068,6 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'experiment-stats': experimentStats,
'experiment-timeseries-results': experimentTimeseriesResults,
'experiment-unarchive': experimentUnarchive,
+ 'experiment-unfreeze-exposure': experimentUnfreezeExposure,
'experiment-update': experimentUpdate,
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-freeze-exposure.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-freeze-exposure.json
new file mode 100644
index 000000000000..1f1461179dd3
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-freeze-exposure.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A unique integer value identifying this experiment.",
+ "type": "number"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-unfreeze-exposure.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-unfreeze-exposure.json
new file mode 100644
index 000000000000..1f1461179dd3
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-unfreeze-exposure.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A unique integer value identifying this experiment.",
+ "type": "number"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}