Uber details AutoClean, an agentic system that combines AI agents with deterministic code transformations to safely remove stale feature flags and millions of lines of code across large monorepos. The architecture relies on CI as the source of truth, bounded fixers, and an independent validation layer known as CodeCourt to prevent regressions and intent drift.
Read original on InfoQ ArchitectureLarge-scale software repositories frequently accumulate technical debt in the form of dormant feature flags, obsolete conditional branches, and unused configurations. Uber introduced AutoClean, an agentic system designed to automate the lifecycle termination of stale feature flags and remove over a million lines of dead code without introducing regressions.
A core architectural challenge in automated refactoring is avoiding unpredictable modifications caused by unconstrained generative AI. AutoClean solves this by enforcing a strict division of labor: deterministic transformation tools handle exact syntax rewrites, boolean evaluations, and dead-branch elimination, whereas AI models manage complex propagation decisions across disparate files and function signatures.
Restricted-Scope Fixers
When automated code transformations break the build or tests, AutoClean routes the failures through scoped fixers. For instance, a test fixer is strictly permitted to modify test suites but cannot touch production code, eliminating the risk of an agent making a test pass by incorrectly altering the underlying business logic.
Passing CI is treated as a necessary baseline rather than a final guarantee of correctness. AutoClean introduces CodeCourt, a secondary validation layer composed of specialized, independent agentic reviewers. Each reviewer assesses isolated invariant properties—such as no added code artifacts, zero intent drift, and absolute semantic preservation—before the pull request is ever presented to human engineers for final sign-off.
Want the fundamentals behind stories like this? Take the free System Design Academy course with certificate.