Feature flags
How do you manage feature flags at scale?
Review the flags that aren't fully on every week, keep each flag's owner in the code, archive flags that are on for everyone and no longer referenced, set state per environment, and give each app and agent a credential scoped to one project. Those five habits are common practice, and they matter more once AI agents are adding flags faster than people can track them.
Updated November 29, 2026
What goes wrong with hundreds of flags?
The rules that work for one team with ten flags stop being enough. With many teams and hundreds of flags, three things fail: nobody knows which flags are still part-way rolled out, which are dead in the code, and who may change what. None of these show up as an error. They show up as an incident traced to a flag nobody remembered, or a cleanup nobody dares to start.
Which flags should you look at first?
The ones that aren't fully live. A flag that's half rolled out is where incidents come from, so review that list every week and decide, flag by flag, to widen it, finish it or kill it. Sort flags that aren't on for everyone to the top of the list, and give agents and scripts a way to fetch just those, such as a filtered JSON listing.
Where should a flag's owner live?
In the code, next to the flag. Owners typed into a dashboard go stale when teams change. Let your SDK register each flag's summary, description and owner from the code every time the app starts, so renaming a team is a one-line change and the list follows. Keeping flags in one typed registry helps too; see how to keep AI-written code behind declared feature flags.
How do you find flags the code no longer uses?
Track which flags the running code still asks about. A flag service can mark a flag as in code when an SDK has registered its key in that environment recently, such as within the last 30 days. A flag that's on for everyone and no longer in code is ready to archive, and archived flags should drop out of the rules the SDKs download. Keep archiving for people and admin tokens, not agents. For the full process, see how to clean up stale feature flags.
How do you split flags across teams and environments?
- By product, not by team. Put the flags an app reads in one project, so each environment's key loads exactly the flags that app needs, and scope each agent's token to that project.
- State per environment. A flag exists in every environment of its project, but its state and rules are set separately, so you can turn it on in development without touching production.
- Limits for agents. Let agents change anything but protected flags in development, and cap how far they can roll out in production, with anything wider waiting for a person.
If you're starting from a mess, begin with an inventory: every flag, its owner, its state in each environment and whether code still uses it. Then decide who may change production.
Frequently asked questions
How many feature flags is too many?
There's no fixed number. The problem is flags nobody owns, flags stuck part-way and flags the code no longer reads. A weekly review of what isn't fully live keeps the count honest.
Who should own a feature flag?
The team that owns the code behind it, recorded in the code next to the flag so the owner stays current.
Should AI agents be able to archive flags?
Usually not. Keep archiving for people and admin tokens, and let agents create, roll out and kill flags within their limits.
Should every environment share one flag state?
No. Keep the flag in every environment but set its state per environment, so testing in development never changes production.