---
title: Smart Gate
description: "Smart Gate reviews pull requests in your GitHub repositories, suggests a feature gate for risky changes, wraps the change in a Statsig gate when you opt in, then ramps, reverts, and cleans up the gate for you."
product: general
lang: en
token_estimate: 914
---
# Smart Gate

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Smart Gate is an AI agent that reviews pull requests in your connected GitHub repositories and flags changes risky enough to ship behind a feature gate. When the PR author opts in, Smart Gate opens a second pull request that wraps the change in a new Statsig feature gate. After the code deploys, Statsig ramps the gate on a schedule, reverts it to 0% if a safeguard alert fires, and opens a cleanup PR once the gate has been at 100% long enough.

Use Smart Gate when you want risky changes to ship behind a gate without hand-writing gate checks, picking metrics, or babysitting a rollout. Create a gate yourself with [Create a feature gate](https://docs.statsig.com/feature-flags/create) when you need custom targeting, a permanent gate, or an experiment. If you already manage gate rollouts with [Release Pipelines](https://docs.statsig.com/release-pipeline/overview), Smart Gate leaves those gates alone and doesn't ramp them.

> **Info:** Availability
>
> Smart Gate is in early access. Statsig enables it per organization. To request access, contact your Statsig account team or [Statsig support](https://docs.statsig.com/support-options).

## How Smart Gate works

Nothing in your code changes until someone opts in on the pull request.

| Stage | What happens |
| --- | --- |
| Review | When a PR opens, Smart Gate assesses how risky the change is. |
| Suggest | For a risky change, Smart Gate comments on the PR with what could break and how to opt in. Otherwise, it marks the PR **No gate needed**. |
| Opt in | The PR author or a collaborator comments `@statsig gate this`. |
| Wrap | Smart Gate creates the gate and opens a wrap PR that puts the change behind it. With the gate off, your app behaves as it does today. |
| Merge | You merge the wrap PR into your branch, then merge your PR as usual. |
| Ramp | After the code deploys, Statsig ramps the gate on your rollout schedule. |
| Revert | If a safeguard alert fires, Statsig turns the gate back off and notifies the PR author. |
| Clean up | After the gate has been fully launched for a while, Smart Gate opens a PR that removes it from your code. |

Smart Gate understands how your codebase already uses Statsig, so the gate it adds reads like code your team wrote: same SDK, same patterns, same style.

Smart Gate keeps the PR author updated in a comment on the PR, and optionally in Slack. For what PR authors see and do, go to [Work with Smart Gate on a pull request](https://docs.statsig.com/smart-gate/pull-requests).

## The gates Smart Gate creates

- **Off in production, on in development and staging**: you can test the new behavior before any user gets it.
- **Monitored**: each gate gets metrics and safeguard alerts from the project settings you choose.
- **Editable**: you can change a gate's rules, metrics, and alerts from the console like any other gate.

## What Smart Gate doesn't do

- **Change code without consent**: Smart Gate only opens a wrap PR after someone on your team opts in.
- **Block your merge**: Smart Gate's check on the PR never fails.

## How Smart Gate handles your code

Smart Gate works on your code in an isolated, short-lived environment, and Statsig and its LLM sub-processors don't use your data to train models. For details, go to [AI governance, security, and privacy](https://docs.statsig.com/compliance/ai_governance_security_privacy).

## Get started

To connect GitHub and turn on Smart Gate, go to [Set up Smart Gate](https://docs.statsig.com/smart-gate/set-up).

