Core Concepts

Flag Lifecycle

Eliminate technical debt proactively. Track flags from creation to stale and archive states, scan code reference usages in CI, and access code removal guides.

Overview

Unused or stale feature flags create clutter in dashboards and bloat codebases. ToggleAI's Flag Lifecycle Manager resolves this by calculating staleness scores based on evaluation metrics, active environments, and codebase references. It highlights "zombie" flags and automates weekly cleanup reports with code-removal guides.

Flag Health Lifecycle

Loading diagram...

Health Status Classification

StatusCriteriaAction Needed
HealthyFlag is active and regularly evaluated.No action required.
StaleCreated > 90 days ago, or staleness score > 0.7.Schedule code removal.
ZombieActive flag with 0 evaluations for 14+ days.Safe to archive immediately.
ArchivedFlag disabled and hidden from main dashboards.Cleaned up in code.

CI Scanner CLI Tool

Upload static occurrences of active feature flags in your codebase using the scanner CLI. The scanner recursively walks directory source files, matches active flags, and sends references to ToggleAI to generate code-removal guides.

Run Scanner Locally

Run the scanning package in your project source directories:

bash
npx toggleai scan --project=my-app --api-key=clientId:secret --dir=./src

Configure in CI/CD (GitHub Actions)

Automate scanning on every code merge to keep your flag health dashboard in sync.

yaml
name: ToggleAI Flag Scan
on:
  push:
    branches: [ main ]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Scan Codebase
        env:
          TOGGLEAI_API_KEY: ${{ secrets.TOGGLEAI_API_KEY }}
        run: npx toggleai scan --project=my-app --dir=./src

Code Removal Guides

When archiving a flag, the Console generates a customized removal guide. This guide shows the exact files, lines, and contextual code snippets matching the flag key. By following the guide, teams can safely clean up stale toggles without guessing.