DoorDash has built a multi-agent LLM system to automate stale feature flag cleanup across its codebase, combining live experimentation data, engineer approval, isolated Git worktrees, and automated validation. In an evaluation of 50 stale flags, the system produced usable pull requests for 45, averaging 13.8 minutes and $4.79 per cleanup, compared with DoorDash’s estimate of one to two hours for manual cleanup.
DoorDash’s experimentation platform manages more than 60,000 feature flags across roughly 623 repositories and creates about 2,300 new flags each month. The company identified more than 1,000 stale flags. A flag is classified as stale when it has not been modified for 90 days, remains referenced in code, is not archived or retired, and is not explicitly excluded. A daily process creates Jira tickets for identified flags.
The cleanup is complicated by DoorDash’s use of dependency-injected wrappers, where the flag definition, client call, and business logic can be distributed across multiple files. A simple Boolean flag can therefore require changes across five to 20 files, including tests.
Existing approaches address some of this problem. Uber’s open-source Piranha uses abstract syntax tree-based transformations to identify and remove stale feature flag code. DoorDash found that this approach did not cover its dependency injection patterns, where relationships between the flag and application logic are semantic rather than directly represented by matching syntax. Piranha provides a contrasting rule-based approach to the LLM-based system used by DoorDash.
The DoorDash workflow uses Google’s Agent Development Kit and has two phases. An orchestrator running Claude Sonnet retrieves stale flag tickets from Jira, searches the relevant repositories, and queries the experimentation platform through Model Context Protocol (MCP) for metadata including rollout percentage and target value. An engineer reviews the generated report and confirms the target value before code changes begin. MCP provides a standardized mechanism for connecting AI applications with external tools and resources.

DoorDash’s two-phase feature flag cleanup workflow (Source: DoorDash Blog Post)
During the second phase, Claude Opus cleanup agents operate in isolated Git worktrees, with up to four agents running concurrently per repository. Agents locate flag references, determine the cleanup strategy, modify source code and tests, and run builds, tests, JaCoCo patch coverage, and Detekt static analysis. A pull request is opened only after the validation checks pass. Each agent has a one-hour timeout, and Gradle runs without its daemon to prevent state sharing between worktrees.
The evaluation produced 31 first-pass merges, 14 revisions, and five engineer interventions. Simple flags achieved a 100% single-pass cleanup rate, compared with 94% for medium complexity flags and 85% for complex flags. The five interventions involved deep call chains and cross-interface parameter threading. DoorDash reported no bugs or regressions in the 50 evaluated changes.

Feature flag cleanup outcomes by complexity across the 50 evaluated flags (Source: DoorDash Blog Post)
The company plans to add confidence scoring for lower-risk cleanups and a post-cleanup code quality pass to identify issues such as misleading variable names after flag removal. The work was accepted for the ICSME 2026 industry track.