A feature flag is a switch in the code or configuration that turns a feature on or off without a new deploy. It separates merging code from releasing it.
Why flags suit agent changes
- You can merge small steps behind a flag, with the feature still off.
- You can enable it for yourself first, then for a few users, then for all.
- If something goes wrong you turn it off in seconds.
Rules
- Name the flag after the feature and give it an owner.
- Default to off. A missing flag must not turn the feature on.
- Test both states.
- Put an expiry date on the flag and an issue to remove it.
- Remove the flag and the old code path once the feature is on for everyone.
Watch for flag debt
Old flags multiply the paths through the code. A flag that stays for a year is a decision nobody made. Ask the agent to find flags past their date, and have a person decide.
Not for everything
A flag does not replace review. A flagged change still gets reviewed, and flags for security-sensitive code need extra care.