Uber has used AutoClean, an agentic system for removing stale feature flag code, to clean up more than 16,000 flags and over 1 million lines of code across its monorepos. The system combines AI agents with deterministic code transformations, continuous integration (CI), and independent validation to prepare changes for human review.
Feature flags allow teams to gradually enable functionality or roll back changes. Once a rollout is complete, however, conditional branches, configuration fields, function parameters, and tests can remain in the codebase. Uber says this residue complicates maintenance and testing, and increases the code AI agents must inspect when working on related tasks.
AutoClean connects to Uber’s feature flag management system to identify flags considered safe to remove. Its cleanup agent searches and edits the code, then uses PolyglotPiranha, Uber’s structural code transformation engine, through the Model Context Protocol. The agent replaces a flag with its permanent value and traces that value through callers, parameters, and conditionals.
Uber describes the division of work:
Static tools handle deterministic rewrites well; AI is most useful for propagation decisions.
PolyglotPiranha handles boolean and conditional simplification deterministically, rather than leaving potentially behavior-changing rewrites entirely to the language model.

AutoClean overview (Source: Uber Blog Post)
The resulting change enters CI. When builds or tests fail, AutoClean routes failures through fixers, trying deterministic repairs before agent-based ones. Fixers have restricted scopes: a test fixer, for example, can edit test files but not production code. Uber says this prevents an agent from making a failing test pass by changing the behavior the test was intended to verify. The system repeats the repair and CI cycle until the change passes or reaches its attempt limit. Uber describes CI as the source of truth for the change.
CI success is not the final safety check. AutoClean runs static checks and then CodeCourt, an agentic validation layer with separate reviewers for properties including no additions, semantic preservation, no intent drift, and no leftover agent artifacts. Each reviewer checks one property independently. If any check fails, the change is abandoned; only changes that pass all checks are sent to the owning team for human review.
Muhammad Ali Akbar, a software engineer, wrote in a LinkedIn discussion,
The CI-as-source-of-truth part is what sold me.
Deepanshu Udhwani, also a software engineer, noted the difference between passing tests and ensuring a cleanup stays within its intended scope.
No intent drift is a different check than no regression.
Uber says a human reviewer makes the final decision on whether a flag is ready to be removed. AutoClean automates the investigation, rewrite, repair, and validation stages, while leaving that decision with the team responsible for the code.