
Bring feature gates to a final state (flags permanently part of your codebase or completely removed) after they have served their purpose, as described in [Feature Gate lifecycle](/feature-flags/feature-flags-lifecycle). In Statsig, use feature gate **Types** to track flags that might be ready for cleanup.

## Types

In your feature gates catalog, different **Types** appear in the Status column and under the filter option:

{% figure %}
![Feature gates catalog with status types filter](/images/feature-flags/permanent-and-stale-gates/224765362-9b9686f2-62b0-4605-8b8c-911987d343e0.png)
{% /figure %}

* **Permanent Gates** (set by you)
  * **Permanent feature gates** are expected to live in your codebase for an extended period, beyond a feature release, usually for operations or infrastructure control. Common examples include user permissions (such as premium features based on subscription level), circuit breakers or disable switches (such as ending a connection to prevent negative customer impact), or support for legacy features in old app versions.
    * There are two ways to mark a gate as **Permanent**:
      * When creating the gate: the **Permanent** box in the gate creation flow
        {% figure %}
        ![Permanent checkbox in gate creation flow](/images/feature-flags/permanent-and-stale-gates/224768058-1a1b74a2-6b5d-4bfd-b73c-e2fc1f4a7a7f.png)
        {% /figure %}
      * After a gate has been created: click on the "..." menu and then "Mark Gate Permanent"
        {% figure %}
        ![Mark Gate Permanent menu option](/images/feature-flags/permanent-and-stale-gates/224763304-2002e482-8ef0-4025-b13c-acb92ffb2bcc.png)
        {% /figure %}
  * Implications of marking a gate as **Permanent**
    * No change in the gate's behavior when called
    * Easy filtering on feature gates catalog
    * More caution in its management: while you can archive or delete a **permanent** feature gate, Statsig shows a warning before proceeding
    * Statsig foregoes reminding you to clean up these gates and may display them differently in the console
  * You can change the gate back to **Temporary** at any point.
    * All newly created feature gates default to **Temporary**, unless you mark them as Permanent. Statsig doesn't display the phrase **Temporary** in the feature gates Catalog or within the individual gates page.
* **Stale Gates** (set by Statsig)
  * **Stale feature gates** indicate to your team that these gates could be good candidates for cleanup. Statsig automatically marks gates as stale based on the following criteria (excludes Permanent and archived gates):
    * Gates created less than 30 days ago, modified in the last 30 days, or referenced by other gates, experiments, or dynamic configs are never considered stale
    * Otherwise, any of the following conditions make a gate stale:
      * The gate has had 0 checks within last 30 days
      * The gate is still being checked but its earliest check was at least 30 days ago
  * Implications of gates being marked as **Stale**
    * No change in the gate's behavior when called
    * Easy filtering on Feature Gates catalog
    * Statsig includes the gate in nudges for cleanup (more below)
  * **Stale Reasons** are the reason why a gate has been set as stale. You can query this information on the [Console API](/console-api/introduction).
    * **None** No Stale Gates should have their reason set as None, this is exclusively for **Temporary** or **Permanent** gates.
    * **STALE\_PROBABLY\_DEAD\_CHECK** There have been no checks in the last 30 days.
    * **STALE\_PROBABLY\_LAUNCHED** The Gate is marked as launched or has an everyone rule passing 100% (rollout rate of 100%).
    * **STALE\_PROBABLY\_UNLAUNCHED** The Gate is marked as disabled or has an everyone rule passing 0% (rollout rate of 0%).
    * **STALE\_PROBABLY\_FORGOTTEN** This gate appears to have been only partially launched for some time. Consider launching or disabling it, or marking it permanent if you need to keep it around.
    * **STALE\_NO\_RULES** The Gate has no set rules.
    * **STALE\_ALL\_TRUE** The Gate has been returning true every time it has been checked for the last 30 days (or number of days configured in project settings). It could probably be removed.
    * **STALE\_ALL\_FALSE** The Gate has been returning false every time it has been checked for the last 30 days (or number of days configured in project settings). It could probably be removed.
    * **STALE\_EMPTY\_CHECKS** The Gate has been returning empty (probably indicating an error) every time it has been checked for the last 30 days (or number of days configured in project settings). It could probably be removed or might need to be investigated.

## Nudges to clean up stale gates

Using the **Stale** type, Statsig provides both in-console and external nudges to remind you to clean up (or make Permanent) your feature gates.

* **In-console:** A reminder appears at the top of the individual feature gate page.
  {% figure %}
  ![Stale gate cleanup reminder notification](/images/feature-flags/permanent-and-stale-gates/224457644-16844256-e7f8-4490-b07e-74f0d85eb6ee.png)
  {% /figure %}
* **Email/Slack:** Statsig sends a monthly email or Slack reminder (if you have enabled the Slack integration) to clean up or mark permanent any stale gates you own. Reminders continue until the gates are cleaned up or marked as permanent.
