What is Feature flag?

A feature flag is a runtime switch that turns a piece of functionality on or off without a redeploy, letting teams ship code dark, roll out gradually, target cohorts, and kill a bad change instantly.

A feature flag (also called a feature toggle) is a conditional in the codebase whose value is controlled at runtime by a configuration system rather than baked in at build time. It decouples deploying code from releasing behavior: you can merge and deploy a feature while it is flagged off, then flip it on for internal users, then a percentage of traffic, then everyone, all without touching the deployment. Flags power several distinct patterns, release flags for gradual rollout and instant kill-switches, experiment flags for A/B tests, ops flags for graceful degradation under load, and permission flags for entitlements. Their great virtue is reversibility: a regression behind a flag is mitigated by changing one value, not by rolling back a deploy. Their great hazard is debt: stale flags accumulate into a combinatorial mess if they are not cleaned up after launch. Feature flags pair naturally with canary deployments and progressive delivery. For an AI agent operating in a codebase, the set of active flags, what each gates, and which are safe to remove is exactly the kind of evolving, team-wide knowledge that benefits from a shared memory layer so the agent reasons about flags consistently across sessions.