1
1
The management of feature flags represents a significant operational challenge for modern software engineering teams, where the ease of implementation often masks the long-term complexity of maintenance. While adding a feature flag to a codebase is a straightforward task, the subsequent removal of that flag once a rollout is complete remains a persistent point of friction. Within many organizations, these flags are frequently left in the codebase for months after their utility has expired, leading to a phenomenon where the original context of the flag fades and more urgent development priorities take precedence. To address this form of technical debt, Atlassian has successfully implemented a system utilizing Agentic Pipelines to automate the cleanup of stale feature flags, a process that has been in active use by at least one internal team since April 2026.
The core difficulty in maintaining feature flags lies in the "cleanup" phase. As flags accumulate, they create a growing backlog that increases cognitive overhead for engineers. When a flag becomes stale, it forces developers to reason around obsolete logic paths whenever they interact with the surrounding code. At Atlassian, the lifecycle of a feature flag is tracked through a dedicated gating system integrated with Jira. Stale flags are automatically identified and converted into tickets within an internal Jira project. Each of these tickets contains critical metadata required for removal, including the flag’s name, its final intended value (typically "true" or "enabled"), the flag type, and the current state of the gate. Despite having all the necessary information, manual cleanup is often deprioritized because it requires codebase-specific knowledge that traditional scripts struggle to handle.
The automated solution developed by Atlassian involves a two-part workflow: a dispatcher that identifies the work and a coding agent that executes the technical changes. This workflow is designed to prepare the necessary code modifications and open a pull request, leaving the final review and merge to human engineers. This "human-in-the-loop" model ensures that while the repetitive labor is automated, the safety and integrity of the codebase remain under the control of the engineering team.
The first stage of the process utilizes Rovo Studio automation. A scheduled rule queries Jira for open flag-cleanup tickets that have been flagged as stale and are eligible for automated removal. This dispatcher mechanism eliminates the need for engineers to manually hunt for cleanup tasks. By fanning out across all eligible tickets, the system can trigger multiple coding agent runs in parallel via Bitbucket Pipelines, passing the unique ticket key as the primary context for each run.
The second stage is the execution by the coding agent. Atlassian’s approach keeps the agent’s prompt intentionally thin to prevent domain logic from becoming scattered across pipeline configurations. Instead, the agent relies on a "skill"—a versioned, reviewable file that encodes the specific patterns of how flags are used within a particular repository. When the agent is triggered, it reads the ticket metadata to understand the flag’s final value and then loads the corresponding flag-cleanup skill.
Crucially, the agent does not immediately begin editing code. The first step in the agentic workflow is verification. Because software repositories are dynamic environments where code changes rapidly, the state of a flag in the codebase may diverge from the information in the Jira ticket. The agent searches the repository to confirm the flag’s presence and its current implementation. If the ticket and the codebase are in disagreement, or if the flag has already been removed by a developer, the agent stops and reports the discrepancy rather than proceeding with potentially erroneous edits.
Once the state is verified, the agent performs the code transformation. This involves inlining the final behavior—keeping the logic branch that matches the flag’s final value—and deleting the obsolete branch, the gate definition, and any associated helper functions or unused imports. This process must account for various coding patterns, such as conditionals, ternary operators, and variable assignments across both frontend and backend systems. After the code is modified, the agent updates any affected tests that previously mocked the discarded flag value.

To ensure the safety of the automated changes, the agent is required to run the repository’s standard suite of linters, type-checks, and tests. A pull request is only opened if all checks pass. If the initial changes result in a failure, the workflow instructs the agent to investigate and attempt to repair the issues within its defined scope. If a safe, passing change cannot be produced, the agent halts the process and reports the failure on the Jira ticket rather than opening a broken pull request.
This system has significantly altered the maintenance landscape for the teams involved. By removing the "start-up work" of reconstructing a flag’s history and locating every usage across a complex codebase, the automation allows engineers to focus solely on the review phase. Since its inception in April 2026, the workflow has been used to manage monthly backlogs of stale flags, with each change undergoing the standard peer-review process.
Several key lessons have emerged from Atlassian’s implementation of Agentic Pipelines. First is the necessity of verification; a cleanup ticket should be treated as context rather than absolute proof of the codebase’s state. Second is the organizational benefit of prioritizing "skills" over "prompts." By encoding the knowledge of flag removal into a versioned skill file, the logic remains reviewable and adaptable as codebase conventions evolve. This prevents the "how-to" knowledge from being trapped in static documentation or individual developers’ heads.
Security and governance are also central to the design of Agentic Pipelines. Atlassian configures repositories with strict branch restrictions and policies that prevent agents from pushing code directly to the main branch. Furthermore, the agents operate with limited token scopes, granting them only the specific permissions required to read the repository, write code, and manage pull requests. This limits the potential impact in the event of a malfunction or unexpected behavior.
The success of this pattern suggests broader applications beyond feature flag removal. Atlassian has identified similar maintenance tasks that meet the criteria for agentic automation: recurring work with a clear trigger, bounded steps, reliable context, and an unambiguous definition of "done." These include vulnerability remediation, dependency updates, and documentation maintenance. For instance, the same agentic logic used to identify and inline a flag can be adapted to identify a vulnerable code pattern and apply a known patch, provided the validation steps (tests and linting) are robust.
Currently, Agentic Pipelines is in a beta phase for Bitbucket Cloud users. Implementation requires enabling the feature within a workspace and configuring a chosen model provider. Atlassian advises that organizations review their specific documentation regarding data handling, credentials, and permissions before enabling agents with write access to their repositories.
The transition to automated feature flag cleanup represents a shift in how technical debt is managed. Rather than relying on sporadic, manual "cleanup sprints" that interrupt product development, the use of Agentic Pipelines integrates maintenance directly into the CI/CD lifecycle. By automating the identification, modification, and validation of stale code, organizations can maintain a leaner codebase while ensuring that human expertise is reserved for high-level architectural decisions and final code validation. As this technology matures, the "skill-based" agentic model is expected to become a standard tool for managing the long-tail complexity of modern software systems.