Find stale flags (>30 days, 100% rolled out). Remove them one by one until none remain.
Start the "Feature Flag Cleanup" loop. - Goal: All stale feature flags (100% rolled out for 30+ days) are removed from the codebase. - Max iterations: 15 - Between iterations run: `grep -r "featureFlag\|feature_flag\|isEnabled\|useFlag" src/ --include="*.ts" --include="*.tsx" -l | wc -l` - Exit when: no stale feature flags remain in the codebase (all flags are either active experiments or recently shipped). Steps: 1. Search the codebase for all feature flag references (check common patterns: featureFlag, isEnabled, useFlag, LaunchDarkly/Statsig/custom) 2. For each flag, determine: when it was created, current rollout percentage, last modified date 3. Identify the stalest flag (100% for longest, or disabled and abandoned) 4. Remove the flag: delete the conditional branches, keep only the "enabled" path 5. Remove the flag definition from configuration 6. Run tests to verify removal didn't break anything 7. Move to the next stale flag Self-pacing instructions: After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when exit condition passes or max iterations reached. Give a short status update each pass.
How it works