DevOps & Cloud · Feature flag cleanup
FlagRetire
Delete the flags you're done with.
Your flag platform knows which flags are finished; your code doesn't. FlagRetire joins the two and lists every flag to remove, archive or fix, with the exact lines of code.
$ flag-retire scan --launchdarkly shop --repo .
FlagRetire: 9 flags, fix code 2 | remove 2 | archive 2 | review 1 | keep 3
ERROR FR004 tax-engine-2: no such flag (src/checkout.ts:17; did you mean tax-engine-v2?)
WARNING FR001 new-checkout: serves true everywhere for 120d: remove, keep the true path
src/checkout.ts:4 if (await ld.variation('new-checkout', user, false)) {
WARNING FR002 holiday-banner: off everywhere for 300d: remove with its dead code
The problem
Teams add feature flags fast and remove them slowly. After a few years there are hundreds: rolled out to everyone months ago, switched off for good, or deleted in the platform while the code still asks for them and silently gets the default. Each one is an if-statement nobody dares to touch.
What it does
Reads LaunchDarkly and Unleash directly with a read-only token, or flagd / OpenFeature files and your own flag table as JSON or CSV
Finds every use in code: SDK calls in Python, JavaScript, TypeScript, Go, Java, Ruby, C# and PHP, string keys, constants that hold a key, and React camelCase keys
Fully rolled out: one value for everyone for 30 days, so remove the flag and keep that path
Off everywhere: the code behind it is dead, so remove both
Catches the silent bugs: code asking for a flag that was deleted or mistyped, or one that is archived, with a "did you mean"
Never suggests removing kill switches, operational or permission flags
CI gate and cleanup tracker: fail a pull request that uses a missing flag, export a CSV per owner
How it works
- Point it at your flag platform and your repository
- Review the list: remove, archive, fix or ask the owner
- Add the CI gate so broken flag references never merge
Works with
Runs in your CI
# Block code that uses a missing or archived flag
flag-retire scan --launchdarkly $LD_PROJECT --repo . --fail-on error --format md --out flags.md
Your data
- Read-only API tokens, taken from environment variables and never stored.
- Code is scanned where it runs; nothing is uploaded.
- Reports hold flag keys, file paths and the matching line only.
Who it's for
Questions
LaunchDarkly already shows stale flags. Why this?
Its code references and stale views work for LaunchDarkly only. FlagRetire works across platforms and in-house flag tables, and it finds the broken cases: code calling flags that no longer exist.
Does it change our code?
No. It lists each flag with the value to keep and every line to edit; `flag-retire show` prints each use with the code around it.
Related
Often used with FlagRetire
BlastRadar
Change impact analysisKnow what a change will touch. Before a release, see every service a change can affect and the line of code that links it. After the release, confirm those services are still healthy.
$300–600 (₹10,000–20,000 in India)View product → DevOps & CloudSLOStudio
SLOs and error budgetsReliability you can measure. Define each SLO in a few lines and get correct burn-rate alerts, an error budget everyone understands, and a release gate, on the monitoring you already run.
$1,500–3,000 (₹40,000–80,000 in India)View product → DevOps & CloudTestScope
Test impact selectionRun the tests that matter. Every pull request runs the tests its change can affect, each with a stated reason, and the full suite whenever a change is too broad to trust.
$1,000–2,500 (₹25,000–60,000 in India)View product →See FlagRetire on your own data
A 30-minute call. We run the product on your export, repository or document and walk you through the results.