A feature flag can finish its job while its code keeps shaping every subsequent change. Before funding a rewrite to improve delivery speed, find out whether obsolete flag paths are making an important workflow harder to change—and whether removing them actually helps. The right unit of analysis is not the flag count. It is the behavior, code and tests that a team must understand to ship the next change safely.
The flag may be finished; its code path may not be
Uber reports removing more than 16,000 flags and over 1,000,000 lines of code through AutoClean over several years. That is a useful illustration of how much code flags can leave behind. It is not a measured delivery-speed gain, and it tells you nothing about the likely return from cleanup in your codebase.
Consider a temporary release flag for a checkout change. The application evaluates the flag, passes the result as a boolean into a pricing function, and branches between old and new behavior. Tests cover both branches; a configuration field and a wrapper in another package carry the value. Once every intended customer should receive the new behavior, removing the flag evaluation alone does not simplify the pricing function. The boolean parameter, obsolete branch, configuration and tests may still require engineers to work out which path matters.
The safe cleanup is more demanding than deleting a conditional. Before removing the parameter, someone must inspect its callers and establish what each one passes. Before dropping a test, someone must determine whether it protects the permanent behavior or only the retired branch. Uber’s cleanup example makes this dependency chain explicit: fixing a flag to its permanent value can lead to changes across callers, branches and configuration.
This is why flags deserve attention in an assessment of change friction. A branch that appears harmless in isolation can make a reviewer ask which behavior is live, make a test suite cover a path nobody intends to ship, or make a routine edit span several packages. Those costs are plausible, not automatic. If the flagged workflow rarely changes, removing the branch may do little for delivery speed. If the branch represents a real customer difference, deleting it would be a product defect, not modernization.
Audit purpose and live behavior before calling a flag stale
Age is a poor deletion rule. LaunchDarkly distinguishes temporary release flags from long-lived operational flags, including kill switches and entitlements. An old kill switch with a clear owner and a tested operating procedure may be exactly the control you want to retain. A newer release flag may already be ready to retire. An unfinished migration may need both paths until its remaining consumers move.
Start a flag register for the workflows under review. For each flag, record its type, owner, intended lifetime, environments, served variations, prerequisites, known source references, affected workflows and any deployed-client considerations. Record evidence gaps as carefully as evidence. Then classify the flag as retain, removal candidate or investigate. “Old” is an observation, not a decision.
Management-console status can help identify candidates but cannot settle the decision. LaunchDarkly’s “Ready for code removal” stage applies to temporary flags meeting criteria in critical environments, including an age of at least 30 days and no prerequisite use there; project lifecycle settings can affect those criteria. The stage means review the flag. It does not establish that every deployed client or background job has stopped depending on it.
Likewise, code search is a starting point, not proof of non-use. LaunchDarkly’s code-reference tooling can find references and aliases, but its documentation describes coverage limits. Without connected repositories, lifecycle status can be inferred from evaluation status without confirming source references. A wrapper may hide the flag key from an obvious search; a repository outside the scan may contain another consumer. Absence of evaluations or search hits should become an investigation item, not a deletion approval.
The assessment question is therefore specific: what behavior does this flag still govern, for whom, and who can authorize a permanent value? If nobody can answer, do not guess from a dashboard. Establish ownership and trace the consumer path first. The same discipline matters when a flag crosses repository or package boundaries: auditing consumers before replacing a shared library is a useful parallel because a found reference is not the same thing as verified runtime behavior.
Choose candidates by cost of change, not age or count
A register can tell you what exists. It cannot tell you what to fund. To make that decision, connect candidate flags to a workflow the organization expects to change. Look at the files and branches touched in recent work, the review questions that delayed it, the test work required and any defects caused by misunderstanding a path. A flag is a stronger cleanup candidate when it sits in frequently changed code and its alternative branch has no remaining purpose.
Record a bounded baseline for that workflow before the pilot. This need not be a grand productivity metric. Capture the recent changes used to select the area, the flag-related questions they raised, the tests that had to cover competing paths and where work waited. If most waiting happened in review, requirements or release coordination, be careful about attributing the delay to flags. Tracing the review bottleneck is more useful than assuming that less code will automatically mean faster delivery.
This selection step also prevents a flag-count target from distorting the work. Retiring dozens of easy flags in untouched code may reduce inventory without improving the workflow you care about. Conversely, one well-chosen temporary flag might remove a difficult fork from a central path. Neither outcome should be advertised in advance as a percentage improvement. State the hypothesis: removing this verified obsolete path should make a specified class of future changes easier to reason about or test. Then check whether it does.

A code audit and technical assessment is valuable at this decision point if the team needs an independent, prioritized diagnosis rather than a rewrite recommendation inferred from the number of flags. Its output should identify the workflow, the evidence for friction, the coverage limits and a bounded first change that can test the hypothesis.
Prove one removal without silently changing behavior
Pilot one well-understood temporary flag. Agree with product and operational owners on the intended permanent behavior, including the environments and clients to which that agreement applies. Trace the flag evaluation through wrappers, callers, parameters, branches, configuration and tests; check other repositories where consumers may live. If the investigation finds a legitimate second behavior, stop treating the work as simple retirement.
Make a narrowly scoped diff that preserves the agreed behavior. Replace the flag-dependent choice with that behavior, simplify callers that no longer need a parameter, remove unreachable code and update tests deliberately. Keep tests that establish the surviving behavior. Inspect any deleted test to make sure it covered only the retired path rather than a business rule that still matters.
Automation can help, but it does not transfer accountability. Uber describes a workflow combining agent-led investigation, deterministic simplification with PolyglotPiranha, CI repair, static checks, separate reviewers and a final decision by the owning team. It also warns that green CI can coexist with an incorrectly deleted test or incomplete cleanup. PolyglotPiranha accepts a flag name and expected behavior, but its repository limits language support to languages used at Uber. Treat the process as an example of layered checks, not a drop-in toolchain or proof that AI cleanup will pay for itself in a smaller system.
Run relevant tests and CI, then review the diff against the behavior agreement: did the surviving tests still assert the right outcome, did every known caller get handled, and did unrelated behavior change? Arrange deployment monitoring and a stop or rollback condition appropriate to the release sequence. Remove application references before archiving the flag configuration. LaunchDarkly warns that an archived flag still evaluated by application code serves the fallback defined in that code; deletion is a later, permanent step. Archiving first can therefore change behavior rather than merely tidy the console.
Decide what to fund after the pilot
Use the pilot to choose the next investment, not to declare victory. The Software Engineering Institute’s modernization framework distinguishes targeted refactoring from rearchitecting and rewriting, and recommends sequencing strategies against goals, constraints and risks. Flag cleanup is one testable, early-stage option. It may also reveal that weak tests, unclear ownership or a structural boundary is the harder problem.
Make the next funding decision from a short evidence packet:
Behavior: What permanent behavior did the owners approve, and which environments, clients and jobs were checked? List unresolved consumers rather than treating them as absent.
Change: Which code and test paths were removed, and which references remain? Include the reviewed diff and any surprising dependencies.
Validation: Which tests, CI checks and behavioral reviews passed? What was observed after deployment, and what stop or rollback condition was available?
Delivery: Compare the next change in the selected workflow with the baseline where possible. Did review questions or test work become simpler, or is it too early to tell?
Decision: Fund further flag retirement only where similar evidence of friction exists. If tests cannot reliably protect the surviving path, fund testability first. If the delay sits in review, requirements or releases, fix that process. If genuinely different behavior or structural coupling remains, scope a staged modernization effort rather than deleting flags to make the count look better.
The pilot is successful if it gives you a defensible next decision—even if that decision is to retain the flags and spend the budget elsewhere.