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.
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.
Health Status Classification
| Status | Criteria | Action Needed |
|---|---|---|
| Healthy | Flag is active and regularly evaluated. | No action required. |
| Stale | Created > 90 days ago, or staleness score > 0.7. | Schedule code removal. |
| Zombie | Active flag with 0 evaluations for 14+ days. | Safe to archive immediately. |
| Archived | Flag disabled and hidden from main dashboards. | Cleaned up in code. |
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:
npx toggleai scan --project=my-app --api-key=clientId:secret --dir=./srcConfigure in CI/CD (GitHub Actions)
Automate scanning on every code merge to keep your flag health dashboard in sync.
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=./srcWhen 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.