How Uber's AutoClean agents safely delete stale feature-flag code
Uber says its AutoClean system has removed 16,000+ stale feature flags and over 1M lines of code using agents, deterministic tools and layered validation.
Uber has published how AutoClean, its system for removing stale feature flags, deletes production code with agents. Uber says that over the past few years it has cleaned up more than 16,000 flags and over 1,000,000 lines of code. The numbers are less useful to copy than the guardrails, which work at any scale.
According to Uber's post (October 31, 2026), the work happens in three stages:
- Rewrite. An agent with file search and editing tools inlines the flag's rolled-out value. It then calls PolyglotPiranha, Uber's deterministic transformation engine, over MCP to simplify the boolean logic. Uber's reasoning is that a small mistake in simplifying a condition can silently change which branch runs in production.
- Fix CI. Cheap deterministic fixers handle failures first, and agentic fixers take the harder cases. Each fixer is scoped tightly: a test fixer can only edit test files. Without that limit, Uber says, an agent will sometimes make a failing test pass by changing the production code.
- Validate. Static checks run first. Then a layer called CodeCourt gives each property its own reviewer agent: no additions, semantics preserved, no intent drift, no agent artifacts. If any reviewer fails the diff, it is abandoned before a human sees it. Uber found that focused reviewers worked better than a single end-to-end reviewer.
A summary by @shao__meng puts the split simply: tools handle the deterministic steps, agents handle judgment calls, and humans make the business decision. For a smaller version, NimblePros applies the same rule, "Tools find. Agents investigate. Humans decide." It runs cleanup on a branch and gets the tests green first.
Still unclear: which model Uber uses, how often diffs get rejected, and whether any of AutoClean is open source.
Sources
- Using AI to Delete Code: Agentic Tech Debt Cleanup at Uber · Uber
- meng shao (@shao__meng) on X · @shao__meng
- Exorcising a Haunted Codebase: Banishing Code Demons with AI Agents · blog.nimblepros.com