Uber's agents removed 16,000 stale feature flags
Uber built AutoClean, a system of AI agents that deletes the on/off switches left in code after a gradual rollout ends. It has cleaned up more than 16,000 of them and removed over a million lines of code. Every change passes tests and a separate review. Uber didn't share timelines, costs or how many changes were rejected.
Problem: Flags leave residue after a rollout ends: conditional branches, config fields, function parameters and tests. That makes code harder to maintain and test, and gives AI agents more code to read when they work nearby.
What they built: AutoClean connects to Uber's flag management system to find flags that are safe to remove. A cleanup agent edits the code using PolyglotPiranha, Uber's structural code transformation engine, through the Model Context Protocol. Changes go through CI, and failures route to fixers that try deterministic repairs before agent-based ones. A test fixer can't edit production code. A separate layer called CodeCourt runs reviewers for properties such as semantic preservation and intent drift, and any failed check abandons the change. Passing changes go to the owning team for review.
Result: Per InfoQ's report of Uber's write-up, more than 16,000 flags were cleaned up and over 1 million lines of code removed across Uber's monorepos. Timelines, costs, success rates and defect data were not reported.
Lesson: Use deterministic tools for rewrites that must keep behavior, and keep AI for deciding how a change spreads. Humans make the final call.
New to this? The key idea
A feature flag is an on/off switch in code that lets a team release a change gradually. Once the rollout is finished, the switch and the old branch stay behind like scaffolding left on a finished house.
Use it at work
Copy this: Pair a rule-based refactoring engine with an agent that decides where to apply it. Run every change through CI. Give each repair agent a narrow scope so it can't weaken the tests it is trying to pass. Add an independent review step for things tests miss, such as intent drift. Send survivors to the code owner.
Watch out: The write-up gives no abandonment rate, no attempt limit for repair loops and no accuracy data for merged changes. Uber's own tools (PolyglotPiranha, CodeCourt) are internal pieces, so expect to assemble your own versions.
Summaries are written by AI from the linked source. Always check the original.